digitalcz/digisign 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

digitalcz/digisign

Composer 安装命令:

composer require digitalcz/digisign

包简介

DigiSign PHP library - provides communication with https://api.digisign.org in PHP via PSR-18 HTTP Client

README 文档

README

Latest Version on Packagist Software License CI Scrutinizer Code Quality codecov Total Downloads

DigiSign PHP library - provides communication with https://api.digisign.org in PHP using PSR-18 HTTP Client, PSR-17 HTTP Factories and PSR-16 SimpleCache.

API documentation is here https://api.digisign.org/api/docs

Install

Via Composer

$ composer require digitalcz/digisign

Configuration

Example configuration in PHP

use DigitalCz\DigiSign\Auth\ApiKeyCredentials;
use DigitalCz\DigiSign\DigiSign;

// Via constructor options
$dgs = new DigiSign([
    'access_key' => '...', 
    'secret_key' => '...'
]);

// Or via methods
$dgs = new DigiSign();
$dgs->setCredentials(new ApiKeyCredentials('...', '...'));

Available constructor options

  • access_key - string; ApiKey access key
  • secret_key - string; ApiKey secret key
  • credentials - DigitalCz\DigiSign\Auth\Credentials instance
  • client - DigitalCz\DigiSign\DigiSignClient instance with your custom PSR17/18 objects
  • http_client - Psr\Http\Client\ClientInterface instance of your custom PSR18 client
  • cache - Psr\SimpleCache\CacheInterface for caching Credentials Tokens
  • sandbox - bool; whether to use sandbox or production API
  • api_base - string; override the base API url
  • signature_tolerance - int; The tolerance for webhook signature age validation (in seconds)

Available configuration methods

use DigitalCz\DigiSign\Auth\Token;
use DigitalCz\DigiSign\Auth\TokenCredentials;
use DigitalCz\DigiSign\DigiSign;
use DigitalCz\DigiSign\DigiSignClient;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Psr16Cache;
use Symfony\Component\HttpClient\Psr18Client;

$dgs = new DigiSign();
// To set your own PSR-18 HTTP Client, if not provided Psr18ClientDiscovery is used
$dgs->setClient(new DigiSignClient(new Psr18Client()));
// If you already have the auth-token, i can use TokenCredentials
$dgs->setCredentials(new TokenCredentials(new Token('...', 123)));
// Cache will be used to store auth-token, so it can be reused in later requests
$dgs->setCache(new Psr16Cache(new FilesystemAdapter()));
// Use sandbox API (https://api.staging.digisign.org)
$dgs->useSandbox(true);
// Overwrite API base
$dgs->setApiBase('https://example.com/api');
// Set maximum age of webhook request to one minute
$dgs->setSignatureTolerance(60);

Example configuration in Symfony

services:
  DigitalCz\DigiSign\DigiSign:
    $options:
      # minimal config
      access_key: '%digisign.accessKey%'
      secret_key: '%digisign.secretKey%'

      # other options
      cache: '@psr16.cache'
      http_client: '@psr18.http_client'
      sandbox: true # use sandbox API

Usage

Create and send Envelope

$dgs = new DigitalCz\DigiSign\DigiSign(['access_key' => '...', 'secret_key' => '...']);

$envelopes = $dgs->envelopes();

$envelope = $envelopes->create([
    'emailSubject' => 'Please sign',
    'emailBody' => 'Hello James, please sign these documents.',
    'senderName' => 'John Smith',
    'senderEmail' => 'john.smith@example.com'
]);

$recipient = $envelopes->recipients($envelope)->create([
    'role' => 'signer',
    'name' => 'James Brown',
    'email' => 'james42@example.com',
    'mobile' => '+420775300500',
]);

$stream = DigitalCz\DigiSign\Stream\FileStream::open('path/to/document.pdf');
$file = $dgs->files()->upload($stream);

$document = $envelopes->documents($envelope)->create([
    'name' => 'Contract',
    'file' => $file->self()
]);

$tag = $envelopes->tags($envelope)->create([
    'type' => 'signature',
    'document' => $document,
    'recipient' => $recipient,
    'page' => 1,
    'xPosition' => 200,
    'yPosition' => 340
]);

$envelopes->send($envelope->id());

See examples for more

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer csfix    # fix codestyle
$ composer checks   # run all checks 

# or separately
$ composer tests    # run phpunit
$ composer phpstan  # run phpstan
$ composer cs       # run codesniffer

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email devs@digital.cz instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

digitalcz/digisign 适用场景与选型建议

digitalcz/digisign 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 43.4k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2020 年 08 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「digisign」 「digi-sign」 「digisign.org」 「digisign.cz」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 digitalcz/digisign 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 digitalcz/digisign 我们能提供哪些服务?
定制开发 / 二次开发

基于 digitalcz/digisign 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 43.4k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 21
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-08-04