mpp/universign-bundle
Composer 安装命令:
composer require mpp/universign-bundle
包简介
Symfony Universign Bundle
README 文档
README
Installation:
To install this bundle, simply run the following command:
$ composer require mpp/universign-bundle
How to run:
Before run, you need to add UNIVERSIGN_ENTRYPOINT_SIGN and UNIVERSIGN_ENTRYPOINT_RA variables in the .env file of your project with the url and the credentials of the universign account.
###> mpp/unviversign-bundle ###
UNIVERSIGN_ENTRYPOINT_SIGN=https://<LOGIN>:<PASSWORD>@sign.test.cryptolog.com/sign/rpc/
UNIVERSIGN_ENTRYPOINT_RA=https://<LOGIN>:<PASSWORD>@sign.test.cryptolog.com/ra/rpc/
###< mpp/unviversign-bundle ###
After this you can use this bundle with your Symfony Project.
How to use:
Here is a presentation of the Universign workflow:
Requests a signature
First, you have to send a transaction to Universign services.
Transaction Request
Here is an example:
... use Mpp\UniversignBundle\Requester\SignerInterface; ... /** * @var SignerInterface; */ private $requester; public function __construct(SignerInterface $requester) { $this->requester = $requester; } ... $transactionRequest = $this->requester->initiateTransactionRequest([ 'signers' => [ [ 'firstname' => 'john', 'lastname' => 'doe', 'organization' => 'dummy company', 'emailAddress' => 'john.doe@dummy-company.com', 'phoneNum' => '+0122334455', 'language' => 'fr', 'birthDate' => new \DateTime::createFromFormat('Y-m-d', '2000-01-01'), ], ], 'documents' => [ 'mpp_contract' => [ 'fileName' => $document->getFileName(), 'content' => $this->storage->resolvePath($document), 'signatureFields' => [ [ 'name' => 'Signature:', 'page' => 18, 'signerIndex' => 0, ], ], ], ], 'finalDocSent' => true, ]); $transactionResponse = $this->requester->requestTransaction($transactionRequest);
Once you have send the request transaction, you will get a TransactionResponse object in which you will find the transaction ID and an URL.
Transaction Response
Here is an example of the TransactionResponse object:
{
'id' => "bde1e661-a217-4d2b-a3ec-160c2e266ff4"
'url' => "https://sign.test.universign.eu/sig/#/?id=7d161638-9fb7-42c9-bb56-c902ea491404"
}
The id value identify the transaction, it allow you to get more information about the transaction, retrieve the signed documents.
The url value is used to sign the documents by the signers.
Requests the signed document
After you have send your transaction request and it has been signed, send a request to get the signed documents with the previous transaction id:
$documents = $this->requester->getDocuments($transactionId);
You will get an array of Document object:
[
0 => [
'id' => 'http.example.com',
'documentType' => 'pdf',
'content' => "JVBERi0xLj[...]UKJb4",
'fileName' => 'contract_test',
'signatureFields' => [
[
'name' => 'Client:',
'page' => 1,
'x' => 100,
'y' => 200,
'signerIndex' => 0,
],
]
'checkBoxTexts' => null,
'metaData' => null,
'title' => null,
'sepaData' => [
'rum' => '87654345678765'
'ics' => 'FR12ZZZ123456'
'iban' => 'FR7630006000011234567890189'
'bic' => 'BREDFRPPXXX'
'recuring' => false
'debtor' => [
'name' => 'Victor Vidal'
'address' => '805, boulevard Richard'
'postalCode' => '32 082'
'city' => 'Ruiz-sur-Dos Santos'
'country' => 'Christmas (Île)'
]
]
'creditor' => [
'name' => 'Marie Pierre'
'address' => 'rue Roger Marie'
'postalCode' => '71 625'
'city' => 'Deschamps-sur-Dupre'
'country' => 'Bosnie-Herzégovine'
]
]
]
The content parameters is your signed document base64 encoded. Simply decode it to get the file.
More Informations:
- Advanced documentation:
- Object Structure:
- Others:
mpp/universign-bundle 适用场景与选型建议
mpp/universign-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12.63k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 07 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「yaml」 「json」 「api」 「xmlrpc」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 mpp/universign-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mpp/universign-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 mpp/universign-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Kinikit - PHP Application development framework MVC component
ext-json wrapper with sane defaults
A package to cast json fields, each sub-keys is castable
A PSR-7 compatible library for making CRUD API endpoints
SUML for PHP
SUML support for Symfony
统计信息
- 总下载量: 12.63k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-29
