olsgreen/adobe-sign-api 问题修复 & 功能扩展

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

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

olsgreen/adobe-sign-api

最新稳定版本:0.1

Composer 安装命令:

composer require olsgreen/adobe-sign-api

包简介

Adobe Sign client for PHP

README 文档

README

Latest Version Tests Software License

This package provides a means easily of interacting with the Adobe Sign API v6.

Installation

Add the client to your project using composer.

composer require olsgreen/adobe-sign-api

Usage

The client assumes you have and access token from the Adobe Sign oAuth flow, I have written a separate package to deal with this, see olsgreen/oauth2-adobe-sign.

Create a new API client instance & authenticate

// Create an instance of the client.
$api = new \Olsgreen\AdobeSign\Client($your_access_token, ['data_center' => 'us2']);

Uploading a file

// Upload a document from a path
$transientDocumentId = $api->documents()->uploadFile('/path/to/my/file.pdf');

// Upload a stream, resource or binary data.
$data = fopen('/path/to/my/file.pdf', 'r');
$transientDocumentId = $api->documents()->upload('file.pdf', 'application/pdf', $data);

Building, creating and sending an Agreement using builders

use \Olsgreen\AdobeSign\Api\Builders\Factory;
use \Olsgreen\AdobeSign\Api\Enums\SignatureTypes;
use \Olsgreen\AdobeSign\Api\Enums\AgreementStates;
use \Olsgreen\AdobeSign\Api\Enums\ParticipantRoles;
...

// Create the base agreement object.
$agreement = Factory::createAgreementInfoBuilder()
    ->setName('Test Agreement')
    ->setSignatureType(SignatureTypes::TYPE_ESIGN)
    ->setState(AgreementStates::IN_PROCESS);

// Add the PDF file for signing to the agreement using the 
// $transientDocumentId from the document upload example above.
$agreement->fileInfos()->add(
    Factory::createFileInfoBuilder()
        ->setLabel('Test File')
        ->setTransientDocumentId($transientDocumentId)
);

// Create a participant set for the signer.
$participantSetsInfo = Factory::createParticipantSetInfoBuilder()
    ->setOrder(1)
    ->setRole(ParticipantRoles::SIGNER);

// Add a participant to the set.
$participantSetsInfo->memberInfos()->add(
    Factory::createParticipantInfoBuilder()
        ->setEmail('signer@domain.com')
);

// Add the participant set to the agreement.
$agreement->participantSetsInfo()->add($participantSetsInfo);

// Create the agreement via the API.
$agreementId = $api->agreements()->create($agreement);

Get an Agreements Signing URLs

// Gets the signing URLs from the API.
$urls = $api->agreements()->getSigningUrls($agreementId);

// Will output similar to:
// [
//     ['email' => 'signer1@domain.com', 'esignUrl' => 'https://secure.adobesign.com/sign1'],
//     ['email' => 'signer2@domain.com', 'esignUrl' => 'https://secure.adobesign.com/sign2']
// ]

Create a Webhook

use \Olsgreen\AdobeSign\Api\Builders\WebhookInfoBuilder;
use \Olsgreen\AdobeSign\Api\Enums\WebhookScopes;
use \Olsgreen\AdobeSign\Api\Enums\WebhookEventNames;

...

$webhook = WebhookInfoBuilder::create()
    ->setName('Test Webhook')
    ->setScope(WebhookScopes::USER)
    ->setUrl('https://mydomain.com/hooks/adobe-sign')
    ->setWebhookSubscriptionEvents([
        WebhookEventNames::AGREEMENT_ALL
    ]);

$webhookId = $api->webhooks()->create($webhook);

统计信息

  • 总下载量: 6.03k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-05