transloyd/service-esign

ESign API 服务门面

0.1.2 2021-02-18 14:34 UTC

This package is not auto-updated.

Last update: 2024-09-28 23:11:59 UTC


README

version

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;

但更好的方法是使用服务容器(依赖注入)!