PHPackages                             bde42/oauth2-marvin - 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. bde42/oauth2-marvin

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

bde42/oauth2-marvin
===================

Marvin (42) OAuth 2.0 Client Provider for League OAuth2-Client

1.0.1(10y ago)114MITPHPPHP &gt;=5.5.0

Since Oct 4Pushed 10y ago2 watchersCompare

[ Source](https://github.com/bde42/php-oauth2-marvin)[ Packagist](https://packagist.org/packages/bde42/oauth2-marvin)[ RSS](/packages/bde42-oauth2-marvin/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

Marvin Provider for OAuth 2.0 Client
====================================

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

This package provides 42 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 bde42/oauth2-marvin

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
if (session('current_user') == null)
{
    $provider = new \BDE42\OAuth2\Client\Provider\Marvin([
        'clientId'          => 'your_client_id',
        'clientSecret'      => 'your_secret',
        'redirectUri'       => 'https://uri/to/redirect'
    ]);

    // If we don't have an authorization code then get one
    if (!isset($_GET['code'])) {
        $authUrl = $provider->getAuthorizationUrl(/*options*/);
        session(['oauth2state' => $provider->getState()]);
        return redirect($authUrl);

    // Check given state against previously stored one to mitigate CSRF attack
    } else if (empty($_GET['state']) || $_GET['state'] !== session('oauth2state'))
    {
        session(['oauth2state' => null]);
        exit('Invalid state');
    }

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

    // Try to get an access token (using the authorization code grant)
    try {
        $user = $provider->getResourceOwner($token);
    } catch (Exception $e) {
        exit('Oh dear...');
    }

    session(['current_user' => $user->getUserInfos()]); //Basic informations (uid, email, name and login)
    //$user->toArray() //Get all user informations whose you have the access authorization

    print_r ("NEW USER : ".json_encode(session('current_user')));
} else {
    print_r ("REGISTERED USER : ".json_encode(session('current_user')));
}
```

Testing
-------

[](#testing)

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

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Kalb Franck](https://github.com/bde42)
- [All Contributors](https://github.com/bde42/oauth2-marvin/contributors)

License
-------

[](#license)

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

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

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

Every ~32 days

Total

2

Last Release

3883d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/672d67633ec5c3dbdb0c2be66143c6f62d2819cf5335449d1527f308c1b8e028?d=identicon)[dren](/maintainers/dren)

---

Top Contributors

[![DrenBx](https://avatars.githubusercontent.com/u/7267182?v=4)](https://github.com/DrenBx "DrenBx (3 commits)")

---

Tags

clientoauthoauth2authorizationauthorisation42marvin

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/bde42-oauth2-marvin/health.svg)

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

###  Alternatives

[stevenmaguire/oauth2-keycloak

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

2276.2M36](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

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

1152.7M11](/packages/patrickbussmann-oauth2-apple)[omines/oauth2-gitlab

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

36761.9k15](/packages/omines-oauth2-gitlab)[league/oauth2-instagram

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

661.1M43](/packages/league-oauth2-instagram)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

261.8M1](/packages/mollie-oauth2-mollie-php)[dalpras/oauth2-gotowebinar

LogMeIn GoToWebinar OAuth 2.0 Client Provider for the PHP League's OAuth 2.0 Client

1245.5k](/packages/dalpras-oauth2-gotowebinar)

PHPackages © 2026

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