PHPackages                             sarhan/oauth2-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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. sarhan/oauth2-docusign

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

sarhan/oauth2-docusign
======================

Docusign OAuth2 provider for League OAuth2 Client

v2.0.1(2y ago)7121.7k↓39.4%2MITPHPPHP ^7.1|^8.0CI failing

Since Nov 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/AlaaSarhan/oauth2-docusign)[ Packagist](https://packagist.org/packages/sarhan/oauth2-docusign)[ Docs](https://github.com/AlaaSarhan/oauth2-docusign)[ RSS](/packages/sarhan-oauth2-docusign/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (3)Versions (9)Used By (0)

Docusign Provider for OAuth 2.0 Client
======================================

[](#docusign-provider-for-oauth-20-client)

[![Latest Version](https://camo.githubusercontent.com/2b05a524005f5e21642465f3ea7d5961e6357b8761faa3bc6c1fc666d95d0162/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f416c616153617268616e2f6f61757468322d646f63757369676e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/AlaaSarhan/oauth2-docusign/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Coverage Status](https://camo.githubusercontent.com/4c0eb798386a748ef9f1b6de0bf4ebe7df0db0ffb25eed4742daf428c4890481/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f416c616153617268616e2f6f61757468322d646f63757369676e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/AlaaSarhan/oauth2-docusign/code-structure)[![Quality Score](https://camo.githubusercontent.com/4e02fc1c0b5d486a84180269ed3340a34ed64a3d44c3d87b2cffc6e9f6647e72/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f416c616153617268616e2f6f61757468322d646f63757369676e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/AlaaSarhan/oauth2-docusign)[![Total Downloads](https://camo.githubusercontent.com/48702f120f269dbf239b5d0e593b85183e9c7963fb1a68af01f25ce31034f475/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73617268616e2f6f61757468322d646f63757369676e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sarhan/oauth2-docusign)

This package provides Docusign OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

Installation
------------

[](#installation)

To install, use composer:

```
composer require sarhan/oauth2-docusign

```

Usage
-----

[](#usage)

Usage is the same as The League's OAuth client, using `\Sarhan\OAuth2\Client\Provider\Docusign` as the provider.

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new \Sarhan\OAuth2\Client\Provider\Docusign([
    'clientId'          => '{docusign-integrator-key}',
    'clientSecret'      => '{docusign-integrator-key-secret}',
    'redirectUri'       => 'https://example.com/callback-url'
]);

if (!isset($_GET['code'])) {

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl();
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: ' . $authUrl);
    exit;

// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {

    unset($_SESSION['oauth2state']);
    exit('Invalid state');

} else {

    // Try to get an access token (using the authorization code grant)
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    // Optional: Now you have a token you can look up a users profile data
    try {

        // We got an access token, let's now get the user's details
        $user = $provider->getResourceOwner($token);

        // Use these details to create a new profile
        printf('Hello %s!', $user->getId());

    } catch (Exception $e) {

        // Failed to get user details
        exit('Oh dear...');
    }

    // Use this to interact with an API on the users behalf
    echo $token->getToken();
}
```

### Refreshing a Token

[](#refreshing-a-token)

```
$provider = new \Sarhan\OAuth2\Client\Provider\Docusign([
    'clientId'          => '{docusign-integrator-key}',
    'clientSecret'      => '{docusign-integrator-key-secret}',
    'redirectUri'       => 'https://example.com/callback-url'
]);

$token = $provider->getAccessToken('refresh_token', [
	'refresh_token' => '{refresh token}'
]);
```

Vendor specific options
-----------------------

[](#vendor-specific-options)

`sandbox`

when passed with `true` to the provider constructor, the provider will direct docuaign endpoint calls to docusign sandbox domain (account-d.docusign.com).

```
$provider = new \Sarhan\OAuth2\Client\Provider\Docusign([
    'clientId'          => '{docusign-integrator-key}',
    'clientSecret'      => '{docusign-integrator-key-secret}',
    'redirectUri'       => 'https://example.com/callback-url',
    'sandbox'           => true
]);
```

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

or

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/AlaaSarhan/oauth2-docusign/blob/master/CONTRIBUTING.md) for details.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/AlaaSarhan/oauth2-docusign/blob/master/LICENSE) for more information.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 78.9% of commits — single point of failure

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

Every ~309 days

Recently: every ~463 days

Total

7

Last Release

899d ago

Major Versions

v0.0.2 → v1.02018-11-07

v1.1.1 → v2.0.02021-03-30

PHP version history (2 changes)v1.1PHP ^5.6|^7.0

v2.0.0PHP ^7.1|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4ac822f5cc401a67c872d18e92a832d23033d22b485f7309b28ebed998dd6a5b?d=identicon)[AlaaSarhan](/maintainers/AlaaSarhan)

---

Top Contributors

[![AlaaSarhan](https://avatars.githubusercontent.com/u/1851753?v=4)](https://github.com/AlaaSarhan "AlaaSarhan (30 commits)")[![ndench](https://avatars.githubusercontent.com/u/2062388?v=4)](https://github.com/ndench "ndench (7 commits)")[![Loupiotte93](https://avatars.githubusercontent.com/u/10848849?v=4)](https://github.com/Loupiotte93 "Loupiotte93 (1 commits)")

---

Tags

docusigndocusign-oauthleague-oauth2oauthoauth2oauth2-clientphpoauthoauth2docusign

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/sarhan-oauth2-docusign/health.svg)

```
[![Health](https://phpackages.com/badges/sarhan-oauth2-docusign/health.svg)](https://phpackages.com/packages/sarhan-oauth2-docusign)
```

###  Alternatives

[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

42121.2M118](/packages/league-oauth2-google)[knpuniversity/oauth2-client-bundle

Integration with league/oauth2-client to provide services

84016.7M61](/packages/knpuniversity-oauth2-client-bundle)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2509.6M48](/packages/thenetworg-oauth2-azure)[stevenmaguire/oauth2-keycloak

Keycloak OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[league/oauth2-facebook

Facebook OAuth 2.0 Client Provider for The PHP League OAuth2-Client

32013.0M66](/packages/league-oauth2-facebook)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)

PHPackages © 2026

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