PHPackages                             dengrocrm/oauth2-dengro - 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. dengrocrm/oauth2-dengro

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

dengrocrm/oauth2-dengro
=======================

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

1.0.5(6y ago)088[1 issues](https://github.com/dengrocrm/oauth2-dengro/issues)1MITPHPCI failing

Since Jan 16Pushed 6y agoCompare

[ Source](https://github.com/dengrocrm/oauth2-dengro)[ Packagist](https://packagist.org/packages/dengrocrm/oauth2-dengro)[ RSS](/packages/dengrocrm-oauth2-dengro/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (6)Used By (1)

DenGro Provider for OAuth 2.0 Client
====================================

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

This package provides DenGro 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 dengrocrm/oauth2-dengro

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Dengro\OAuth2\Client\Provider\Dengro([
    'clientId'          => '{dengro-client-id}',
    'clientSecret'      => '{dengro-client-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->getNickname());

    } 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();
}
```

### Managing Scopes

[](#managing-scopes)

When creating your DenGro authorization URL, you can specify the state and scopes your application may authorize.

```
$options = [
    'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE',
    'scope' => ['user','user:email','repo'] // array or string
];

$authorizationUrl = $provider->getAuthorizationUrl($options);
```

If neither are defined, the provider will utilize internal defaults.

- user
- user:email

Testing
-------

[](#testing)

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

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Daniel Davidson](https://github.com/dan-rally)
- [Steven Maguire](https://github.com/stevenmaguire)
- [All Contributors](https://github.com/thephpleague/oauth2-client/contributors)

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 83.3% 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 ~64 days

Total

5

Last Release

2414d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/891a22aae45fd8a1b12e9e585f61f5f972ba0677d7ec114c8e2c43d7141ddde8?d=identicon)[dengrocrm](/maintainers/dengrocrm)

---

Top Contributors

[![dan-rally](https://avatars.githubusercontent.com/u/23233956?v=4)](https://github.com/dan-rally "dan-rally (10 commits)")[![RoussKS](https://avatars.githubusercontent.com/u/7203382?v=4)](https://github.com/RoussKS "RoussKS (2 commits)")

---

Tags

clientoauthoauth2authorizationauthorisationdengro

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/dengrocrm-oauth2-dengro/health.svg)

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

###  Alternatives

[stevenmaguire/oauth2-keycloak

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

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

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

1132.5M6](/packages/patrickbussmann-oauth2-apple)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[omines/oauth2-gitlab

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

36721.5k13](/packages/omines-oauth2-gitlab)

PHPackages © 2026

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