laulamanapps/document-signer-docusign 问题修复 & 功能扩展

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

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

laulamanapps/document-signer-docusign

Composer 安装命令:

composer require laulamanapps/document-signer-docusign

包简介

DocuSign eSignature implementation of the document signer SDK.

README 文档

README

DocuSign eSignature implementation of the SignatureProvider contract from laulamanapps/document-signer-sdk.

Uses the OAuth 2.0 JWT user-consent grant to authenticate — no per-call user interaction once the integration user has granted consent.

Install

composer require laulamanapps/document-signer-docusign

Quick start

use LauLamanApps\DocumentSigner\Sdk\Document\Document;
use LauLamanApps\DocumentSigner\Sdk\Envelope\Envelope;
use LauLamanApps\DocumentSigner\Sdk\Signer\Signer;
use LauLamanApps\DocumentSigner\DocuSign\DocuSignConfig;
use LauLamanApps\DocumentSigner\DocuSign\DocuSignProvider;

$provider = new DocuSignProvider(new DocuSignConfig(
    integrationKey: getenv('DOCUSIGN_INTEGRATION_KEY'),
    userId:         getenv('DOCUSIGN_USER_ID'),
    accountId:      getenv('DOCUSIGN_ACCOUNT_ID'),
    privateKey:     file_get_contents('/path/to/private.pem'),
    oauthBaseUrl:   'account-d.docusign.com',           // 'account.docusign.com' in prod
    apiBaseUrl:     'https://demo.docusign.net/restapi', // production URL from userinfo
));

$receipt = $provider->send(new Envelope(
    name:         'Statement of Work',
    documents:    [new Document(
        id:   'sow',
        name: 'SoW',
        html: '<p>{[signature:customer:sig]} on {[date:customer:signdate]}</p>',
    )],
    signers:      [new Signer(key: 'customer', name: 'Jane Doe', email: 'jane@example.com')],
    emailSubject: 'Please sign the SoW',
));

echo $receipt->provider;           // "docusign" (DocuSignProvider::NAME)
echo $receipt->providerEnvelopeId; // DocuSign envelopeId GUID

What it does

For every document in the envelope, this package:

  1. Parses {[type:signer:name]} placeholders out of the HTML.
  2. Substitutes each one with a hidden anchor token (**DS:type:signer:name**).
  3. Renders the HTML to PDF via the SDK's PdfRenderer.
  4. Base64-encodes each PDF and POSTs the envelope to POST /v2.1/accounts/{accountId}/envelopes with one anchor tab per placeholder under the correct recipient.
  5. Returns an EnvelopeReceipt containing the DocuSign envelopeId and a normalised EnvelopeStatus.

Access tokens are minted via JWT and cached in memory by DocuSignJwtAuth until 60s before expiry. Reuse one DocuSignProvider per process.

Field mapping

SDK FieldType DocuSign tab bucket
Signature signHereTabs
Initials initialHereTabs
Text textTabs
Date dateSignedTabs
Checkbox checkboxTabs

One-time setup: user consent

The first time the integration key impersonates a user, the user must approve consent in a browser:

https://account-d.docusign.com/oauth/auth
    ?response_type=code
    &scope=signature%20impersonation
    &client_id=YOUR_INTEGRATION_KEY
    &redirect_uri=https://www.docusign.com

Use account.docusign.com in production. After consent, JWT exchange runs non-interactively from then on.

Requirements

  • PHP 8.5
  • laulamanapps/documentsigner-sdk
  • firebase/php-jwt (pulled automatically)
  • A DocuSign developer/production account, integration key, RSA key pair, and the impersonated user's GUID
  • Node.js + Puppeteer (for the default Browsershot renderer)

Documentation

The full provider guide — credentials, JWT setup, demo vs prod URLs, endpoint mapping, status mapping, sequential signing, token caching, troubleshooting — lives in the SDK's docs:

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-06-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固