transloyd / service-esign
ESign API 服务门面
0.1.2
2021-02-18 14:34 UTC
Requires
- ext-json: *
- doctrine/collections: *
- guzzlehttp/guzzle: *
- symfony/dotenv: ^5.1
Requires (Dev)
- php-http/mock-client: ^1.4
- phpunit/phpunit: ^8
This package is not auto-updated.
Last update: 2024-09-28 23:11:59 UTC
README
API 服务门面
设置
$ composer install
测试
$ vendor/bin/phpunit tests/
如何使用
public function __constructor( ..., GuzzleHttp\Client $client){
...
$this->provider = new Provider($client, new GuzzleMessageFactory());
...
}
...
$documentInBase64 = BASE_64_HASH;
$keyDataInBase64 = BASE_64_HASH;
$keyPass = $_POST['keyPass'];
$eSign = new ESign($this->provider);
$eSignManager = new ESignManager($eSign);
$signedDocumentRaw = $eSignManager->getSignedDocumentRaw($documentInBase64, $keyDataInBase64, $keyPass);
$signedDocument = base64_decode($signedDocumentRaw);
return $signedDocument;
但更好的方法是使用服务容器(依赖注入)!