transloyd/service-esign

Service facade for ESign API

0.1.2 2021-02-18 14:34 UTC

This package is not auto-updated.

Last update: 2024-04-27 21:21:42 UTC


README

version

Service facade for API

Setup

$ composer install

Tests

$ vendor/bin/phpunit tests/

How to use

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;

But better is to use Service Container (Dependency Injection)!