PHP code example of qingze-lab / esignbao-sdk-php-7.0
1. Go to this page and download the library: Download qingze-lab/esignbao-sdk-php-7.0 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/ */
qingze-lab / esignbao-sdk-php-7.0 example snippets
use QingzeLab\ESignBao\Client;
use QingzeLab\ESignBao\Config\Configuration;
$config = new Configuration(
'your_app_id',
'your_app_secret',
'https://smlopenapi.esign.cn' // 沙箱环境
);
$client = new Client($config);
use QingzeLab\ESignBao\Client;
use QingzeLab\ESignBao\Config\Configuration;
use QingzeLab\ESignBao\Log\LaravelLogger;
public function register()
{
$this->app->singleton(Client::class, function ($app) {
$config = new Configuration(
env('ESIGN_APP_ID'),
env('ESIGN_APP_SECRET'),
env('ESIGN_API_URL', 'https://openapi.esign.cn')
);
// 使用 Laravel 的日志系统
$config->setLogger(new LaravelLogger(app('log')));
return new Client($config);
});
}
public function sign(Client $client)
{
// ...
}
use QingzeLab\ESignBao\Client;
use QingzeLab\ESignBao\Config\Configuration;
class ESignService
{
protected static $client;
public static function getClient()
{
if (!self::$client) {
$config = new Configuration(
config('esign.app_id'),
config('esign.app_secret'),
config('esign.api_url')
);
self::$client = new Client($config);
}
return self::$client;
}
}