dokobit/ws-api-sdk-php

Dokobit.com 电子签名 WS API 客户端

2.1.0 2023-09-06 09:48 UTC

This package is auto-updated.

Last update: 2024-09-15 14:59:59 UTC


README

Code Coverage Build Status

如何开始?

检查 tests/Integration 目录下的集成测试以了解库的使用案例。

日志请求

自定义 PSR-3 日志记录器

use GuzzleHttp\Middleware;
use GuzzleHttp\MessageFormatter;
use Monolog\Logger;

$log = Middleware::log(new Logger('requests'), new MessageFormatter(MessageFormatter::DEBUG));

$client = Dokobit\Client::create([
    'apiKey' => 'xxxxxx',
    'sandbox' => true,
], $log);

阅读更多

http://www.php-fig.org/psr/psr-3/

https://github.com/Seldaek/monolog

调试

要深入了解发生的错误,请使用以下方法。A

echo (string) $exception->getMessage()
echo (string) $exception->getPrevious()->getResponse()
var_dump( $exception->getResponseData() )

适用于所有异常类,除了 UnexpectedErrorQueryValidator

开发

包括集成测试在内的完整测试套件

phpunit

不要忘记在 phpunit.xml 中定义 SANDBOX_API_KEY

仅运行单元测试

phpunit --testsuite=Unit

仅运行集成测试

phpunit --testsuite=Integration

运行单个测试用例

phpunit tests/Integration/MobileSignTest.php