PHPackages                             la-souris/document-signer-docusign - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. la-souris/document-signer-docusign

ActiveLibrary

la-souris/document-signer-docusign
==================================

DocuSign eSignature implementation of the document signer SDK.

v1.0.0(yesterday)04↑2900%2MITPHP ^8.3

Since Jul 22Compare

[ Source](https://github.com/la-souris/package-document-signer-docusign)[ Packagist](https://packagist.org/packages/la-souris/document-signer-docusign)[ RSS](/packages/la-souris-document-signer-docusign/feed)WikiDiscussions Synced today

READMEChangelog (1)Dependencies (4)Versions (2)Used By (2)

DocuSign eSignature implementation of the document signer SDK
=============================================================

[](#docusign-esignature-implementation-of-the-document-signer-sdk)

DocuSign eSignature implementation of the [`SignatureProvider`](https://github.com/la-souris/package-document-signer-sdk/blob/main/src/Provider/SignatureProvider.php) contract from [`la-souris/document-signer-sdk`](https://github.com/la-souris/package-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
-------

[](#install)

```
composer require la-souris/document-signer-docusign
```

Quick start
-----------

[](#quick-start)

```
use LaSouris\DocumentSigner\Sdk\Document\Document;
use LaSouris\DocumentSigner\Sdk\Envelope\Envelope;
use LaSouris\DocumentSigner\Sdk\Signer\Signer;
use LaSouris\DocumentSigner\DocuSign\DocuSignConfig;
use LaSouris\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: '{[signature:customer:sig]} on {[date:customer:signdate]}',
    )],
    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
------------

[](#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.

Downloads
---------

[](#downloads)

`downloadSigned()`, `downloadSignedDocument()`, and `downloadAudit()` all write to a temp file and hand you an `\SplFileInfo` — check the extension:

```
$archive = $provider->downloadSigned($envelopeId);
// $archive->getExtension() === 'zip'
// A ZIP with one signed PDF per envelope document (endpoint: /envelopes/{id}/documents/archive)

$pdf = $provider->downloadSignedDocument($envelopeId, 'sow');
// $pdf->getExtension() === 'pdf'
// The signed PDF for a single document. Pass the same id you set on
// Document::$id when calling send() ('sow' above) — resolved to DocuSign's
// positional id via the sdkDocumentMap envelope custom field (see setup below).
// Throws the retryable SignedDocumentUnavailableException if it isn't ready yet.

$audit = $provider->downloadAudit($envelopeId);
// $audit->getExtension() === 'pdf'
// The Certificate of Completion PDF — DocuSign's human-readable evidence report
// (endpoint: /envelopes/{id}/documents/certificate). For the raw audit-events
// JSON, call DocuSignClient::downloadAuditEventsJson() directly.
```

Callers own the file lifecycle — copy or `@unlink()` when done.

Field mapping
-------------

[](#field-mapping)

SDK `FieldType`DocuSign tab bucket`Signature``signHereTabs``Initials``initialHereTabs``Text``textTabs``Date``dateSignedTabs``Checkbox``checkboxTabs`Field positioning
-----------------

[](#field-positioning)

Fields are placed by anchoring each DocuSign tab to the hidden `{[type:signer:name]}` marker in the rendered PDF. DocuSign otherwise seats an anchored tab *above* the marker, so this package offsets every tab so its **top edge lands on the marker** — the same reference point ValidSign uses, so the two providers position identically. Each field type is also sent with an explicit size mirroring ValidSign's.

If a whole document still sits slightly high or low on your account, nudge every field with one knob — no code change:

```
new DocuSignConfig(
    // ...credentials...
    anchorYOffsetPixels: 6,   // move every field 6px DOWN (negative = up). Default 0.
);
```

(In the Laravel/Symfony packages this is the `anchor_y_offset_pixels` provider config value / `DOCUSIGN_ANCHOR_Y_OFFSET_PIXELS` env var.)

One-time setup: user consent
----------------------------

[](#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.

One-time setup: envelope custom fields
--------------------------------------

[](#one-time-setup-envelope-custom-fields)

`downloadSignedDocument($envelopeId, $documentId)` lets you fetch a single signed document by the **same `Document::$id` you set when sending** — even though DocuSign identifies documents only by a positional id (`"1"`, `"2"`) and by name. To bridge that, `send()` records a small JSON map of `Document::$id → positional id` in an **envelope-level text custom field named `sdkDocumentMap`**, and the download reads it back from `GET /envelopes/{id}/custom_fields`.

This field is written ad-hoc at send time and needs **no admin setup on a default account** — it is an *envelope* custom field, not a DocuSign *document*custom field (those must be pre-defined by an admin) and not the inline per-document field DocuSign silently drops.

The one caveat: some accounts enable a restriction that only allows **account-defined** custom fields on envelopes. If yours does, a DocuSign admin must either relax that restriction or add an account custom field named `sdkDocumentMap` (free text, not required, not shown) — otherwise the field is dropped and `downloadSignedDocument()` can't resolve ids. You can confirm the round-trip on your account with `verify-custom-field-roundtrip.php` in this package.

Requirements
------------

[](#requirements)

- PHP 8.3
- `la-souris/document-signer-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
-------------

[](#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:

- [DocuSign provider guide](https://github.com/la-souris/package-document-signer-sdk/blob/main/docs/providers/docusign.md)
- [Placeholder syntax](https://github.com/la-souris/package-document-signer-sdk/blob/main/docs/placeholders.md)
- [PDF rendering](https://github.com/la-souris/package-document-signer-sdk/blob/main/docs/pdf-rendering.md)
- [Architecture overview](https://github.com/la-souris/package-document-signer-sdk/blob/main/docs/architecture.md)

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance100

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/930ca3b1756d00a63c8ff3363e81f16f961cf3ef79ff0c9d362670c36d97e456?d=identicon)[LauLaman](/maintainers/LauLaman)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/la-souris-document-signer-docusign/health.svg)

```
[![Health](https://phpackages.com/badges/la-souris-document-signer-docusign/health.svg)](https://phpackages.com/packages/la-souris-document-signer-docusign)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k108.5M924](/packages/laravel-socialite)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k46](/packages/civicrm-civicrm-core)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k46](/packages/neuron-core-neuron-ai)[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

123256.9k1](/packages/ellaisys-aws-cognito)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
