PHPackages                             dilab/envato-oauth2-provider - 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. dilab/envato-oauth2-provider

ActiveOauth2-provider[Authentication &amp; Authorization](/categories/authentication)

dilab/envato-oauth2-provider
============================

Envato OAuth2 Provider

0.1.0(10y ago)3701[1 issues](https://github.com/dilab/envato-oauth2-provider/issues)MITPHPPHP &gt;=5.4.0

Since Jun 17Pushed 10y ago3 watchersCompare

[ Source](https://github.com/dilab/envato-oauth2-provider)[ Packagist](https://packagist.org/packages/dilab/envato-oauth2-provider)[ RSS](/packages/dilab-envato-oauth2-provider/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Envato Provider for OAuth 2.0 Client
====================================

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

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

[](#installation)

To install, use composer:

`composer require dilab/envato-oauth2-provider`

Authorization Code Flow
-----------------------

[](#authorization-code-flow)

```
$provider = new \Dilab\OAuth2\Client\Provider\Envato([
    'clientId'          => '{envato-client-id}',
    'clientSecret'      => '{envato-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->state;
    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
        $userDetails = $provider->getUserDetails($token);

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

    } catch (Exception $e) {

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

    // Use this to interact with an API on the users behalf
    echo $token->accessToken;
}

```

Some Auth User Data
-------------------

[](#some-auth-user-data)

### $provider-&gt;getUserDetails($token)

[](#provider-getuserdetailstoken)

User Object:

```
$user->name

$user->firstname

$user->lastname

$user->location

$user->imageurl

```

### $provider-&gt;getUserEmail($token)

[](#provider-getuseremailtoken)

String: the currently logged in user's email address

### $provider-&gt;getScreenName($token)

[](#provider-getscreennametoken)

String: the currently logged in user's Envato Account username

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3989d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/465cbccb0942f3dfafdb393d46757720fe99af53ac04c6ae1d82b97c2f0e2b18?d=identicon)[xuding](/maintainers/xuding)

---

Top Contributors

[![dilab](https://avatars.githubusercontent.com/u/218813?v=4)](https://github.com/dilab "dilab (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dilab-envato-oauth2-provider/health.svg)

```
[![Health](https://phpackages.com/badges/dilab-envato-oauth2-provider/health.svg)](https://phpackages.com/packages/dilab-envato-oauth2-provider)
```

###  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)[patrickbussmann/oauth2-apple

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

1132.5M6](/packages/patrickbussmann-oauth2-apple)[microsoft/kiota-authentication-phpleague

Authentication provider for Kiota using the PHP League OAuth 2.0 client to authenticate against the Microsoft Identity platform

153.2M7](/packages/microsoft-kiota-authentication-phpleague)

PHPackages © 2026

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