PHPackages                             digitalgdn/oauth2-sheepcrm - 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. digitalgdn/oauth2-sheepcrm

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

digitalgdn/oauth2-sheepcrm
==========================

SheepCRM OAuth 2.0 support for the PHP League's OAuth 2.0 Client

03PHP

Since Jul 18Pushed 9mo agoCompare

[ Source](https://github.com/DigitalGdn/oauth2-sheepcrm)[ Packagist](https://packagist.org/packages/digitalgdn/oauth2-sheepcrm)[ RSS](/packages/digitalgdn-oauth2-sheepcrm/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

sheepCRM Provider for OAuth 2.0 Client
======================================

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

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

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

[](#installation)

```
composer require DigitalGdn/oauth2-sheepcrm

```

Usage
-----

[](#usage)

```
$sheepProvider = new \DigitalGdn\OAuth2\Client\Provider\Sheep([
    'clientId'     => 'yourId',          // The client ID assigned to you by sheepCRM
    'clientSecret' => 'yourSecret',      // The client password assigned to you by sheepCRM
    'redirectUri'  => 'yourRedirectUri'  // The return URL you specified for your app on sheepCRM
]);

// Get authorization code
if (!isset($_GET['code'])) {
    // Options are optional, defaults shown below
    $options = ['scope' => ['read', 'write', 'read_membership', 'introspection']];
    // Get authorization URL
    $authorizationUrl = $sheepProvider->getAuthorizationUrl($options);

    // Get state and store it to the session
    $_SESSION['oauth2state'] = $sheepProvider->getState();

    // Redirect user to authorization URL
    header('Location: ' . $authorizationUrl);
    exit;
// Check for errors
} elseif (empty($_GET['state']) || (isset($_SESSION['oauth2state']) && $_GET['state'] !== $_SESSION['oauth2state'])) {
    if (isset($_SESSION['oauth2state'])) {
        unset($_SESSION['oauth2state']);
    }
    exit('Invalid state');
} else {
    // Get access token
    try {
        $accessToken = $sheepProvider->getAccessToken(
            'authorization_code',
            [
                'code' => $_GET['code']
            ]
        );
    } catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
        exit($e->getMessage());
    }

    // Get resource owner
    try {
        $resourceOwner = $sheepProvider->getResourceOwner($accessToken);
    } catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
        exit($e->getMessage());
    }

    // Now you can store the results to session etc.
    $_SESSION['accessToken'] = $accessToken;
    $_SESSION['resourceOwner'] = $resourceOwner;

    var_dump(
        $resourceOwner->getId(),
        $resourceOwner->getUsername(),
        $resourceOwner->getFirstName(),
        $resourceOwner->getLastName(),
        $resourceOwner->getName(),
        $resourceOwner->getEmail(),
        $resourceOwner->getActiveMember(),
        $resourceOwner->toArray()
    );
}
```

For more information see the PHP League's general usage examples.

Testing
-------

[](#testing)

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

License
-------

[](#license)

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

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance40

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/43ee378e90b73c9da2f7f08d718a9cafb904b6ca7d0df77f14ed7534b76f3a69?d=identicon)[bkno](/maintainers/bkno)

---

Top Contributors

[![bkno](https://avatars.githubusercontent.com/u/426436?v=4)](https://github.com/bkno "bkno (6 commits)")

### Embed Badge

![Health badge](/badges/digitalgdn-oauth2-sheepcrm/health.svg)

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

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

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

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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