PHP code example of abbotton / esign

1. Go to this page and download the library: Download abbotton/esign library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

abbotton / esign example snippets


// 初始化操作
use Abbotton\Esign\factory\Factory;

Factory::init('your app id', 'your app secret');
// 根据需要设置是否开启debug
Factory::setDebug(true);
// 根据需要配置是否开启代理
Factory::setENABLEHTTPPROXY(true);
Factory::setHTTPPROXYIP('http://127.0.0.1');
Factory::setHTTPPROXYPORT('1234');
// 根据需要配置沙盒环境,注意:如果配置了沙盒环境,记得修改对应的`app id`和`app secret`,否则会报错。
Factory::setHost('https://smlopenapi.esign.cn');
/**
 * 接下来根据自己的需要调用不同的静态方法就可以了
 * 
 * 步骤:
 * 1、现在官网找到要调用的接口URI地址
 * 2、在本扩展包中搜索URI地址中的关键字即可找到对应的类
 * 3、通过静态方法调用这个类即可。
 * 
 * 举个栗子:
 * 查询个人签署账号对应URI地址是:/v1/accounts/{accountId}。
 * 通过关键字'v1/accounts'搜索,可以发现该接口对应文件为:src/factory/account/QryPersonByaccountId.php
 * 那么调用这个类然后传递指定参数即可, 请参考下方代码:
 */
 
 use Abbotton\Esign\factory\base\Account;
 use Abbotton\Esign\factory\account\QryPersonByaccountId;
 $accountInfo = Account::QryPersonByaccountId()->execute()->getBody();
 var_dump($accountInfo);