ESign

根据e签宝官方文档开发的一个 PHP 扩展包, 悟空 API V2 SDK

安装

$ composer require achais/esign:dev-master -vvv

使用

// 配置信息 $config = [ 'debug' => true, // 是否开启调试 'app_id' => "****", // 请替换成自己的 AppId 'secret' => '****', // 请替换成自己的 Secret 'production' => false, // 是否正式环境 'log' => [ 'level' => 'debug', 'permission' => 0777, 'file' => '/tmp/esign.log', // 开启调试时有效, 可指定日志文件地址 ], ]; $eSign = new AchaisESignApplication($config); $thirdPartyUserId = 'your_party_user_id'; // 用户唯一标识,可传入第三方平台的个人用户id、证件号、手机号、邮箱等,如果设置则作为账号唯一性字段,相同信息不可重复创建。 $name = 'your_name'; // 姓名 $idType = 'CRED_PSN_CH_IDCARD'; // 证件类型 $idNumber = 'your_id_number'; // 证件号 $mobile = 'your_mobile'; // 手机号, 签署流程开始时对应的签署人会收到短信通知 $email = 'your_email'; // 邮箱地址, 签署流程开始时对应的签署人会收到邮件通知 // 个人账户创建, 有唯一标志, 需要记录返回的 accountId $accountInfo = $eSign->account->createPersonAccount($thirdPartyUserId, $name, $idType, $idNumber, $mobile, $email); $accountId = $accountInfo['accountId']; // 测试合同模板ID $templateId = 'd895b34de77041dca853aa454c042cb2'; // 测试合同模板填充变量 $simpleFormFields = [ '1a54591dcb5f40bb86048743e7e21c18' => '测试名称', '9b55340f5a7a4b089dd7c03a397fa4ef' => '测试甲方', 'c7efd37736a94e1c85ffb21fd0de88ff' => date('Y-m-d'), ]; // 根据模板创建文档 $fileInfo = $eSign->file->createByTemplateId($templateId, '租赁合同', $simpleFormFields); $fileId = $fileInfo['fileId']; // 创建一个签署流程 $flowInfo = $eSign->signflow->createSignFlow("租赁合同"); $flowId = $flowInfo['flowId']; // 把文档加入签署流程中 $addDocRet = $eSign->signflow->addDocuments($flowId, $fileId); // 在签署流程中添加一个手动签署区域, 前提是流程已经添加文档, 同时指定签署人 accountId $handSignData = $eSign->signflow->addHandSign($flowId, $fileId, $accountId, 1, 100, 100); // 签署流程开始, 签署人会收到通知 (前提有 mobile/email) $startSignFlowRet = $eSign->signflow->startSignFlow($flowId); echo $startSignFlowRet;

更多方法

AchaisESignApplication 提供了几个服务列在了 $providers 属性里面, 想看使用方法的朋友最好直接阅读源码噢~ 我偷懒

查看方法和参数, 快速跳转链接

AccessToken 相关点击查看 签署方账户API 相关点击查看 文件模板API 相关点击查看 签署流程API 相关点击查看

贡献

You can contribute in one of three ways:

File bug reports using the issue tracker. Answer questions or fix bugs on the issue tracker. Contribute new features or update the wiki.

The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.

License

MIT

版权声明:

1、该文章(资料)来源于互联网公开信息,我方只是对该内容做点评,所分享的下载地址为原作者公开地址。
2、网站不提供资料下载,如需下载请到原作者页面进行下载。
3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考学习用!
4、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。