PHPackages                             qdequippe/oauth2-symfony-connect - 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. qdequippe/oauth2-symfony-connect

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

qdequippe/oauth2-symfony-connect
================================

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

v2.0(2y ago)3157.5k↑315.5%2MITPHPPHP &gt;=8.1CI passing

Since May 25Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/qdequippe/oauth2-symfony-connect)[ Packagist](https://packagist.org/packages/qdequippe/oauth2-symfony-connect)[ RSS](/packages/qdequippe-oauth2-symfony-connect/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (7)Dependencies (4)Versions (8)Used By (0)

SymfonyConnect Provider for OAuth 2.0 Client
============================================

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

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

Inspired by  and .

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

[](#installation)

To install, use composer:

```
composer require qdequippe/oauth2-symfony-connect

```

Usage
-----

[](#usage)

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

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Qdequippe\OAuth2\Client\Provider\SymfonyConnect([
    'clientId'          => '{symfony-connect-client-id}',
    'clientSecret'      => '{symfony-connect-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 SymfonyConnect authorization URL, you can specify the state and scopes your application may authorize.

```
$options = [
    'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE',
    'scope' => ['SCOPE_PUBLIC', 'SCOPE_EMAIL'] // array or string ['SCOPE_PUBLIC SCOPE_EMAIL']
];

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

Testing
-------

[](#testing)

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

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Quentin Dequippe](https://github.com/qdequippe)
- [All Contributors](https://github.com/qdequippe/oauth2-symfony-connect/contributors)

Code license
------------

[](#code-license)

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

Thanks
------

[](#thanks)

-
-

Symfony Trademark &amp; Licenses
--------------------------------

[](#symfony-trademark--licenses)

Symfony ™ is a trademark of Symfony SAS. All rights reserved. See [Trademark &amp; Licenses](https://symfony.com/license) details.

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance55

Moderate activity, may be stable

Popularity38

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~247 days

Recently: every ~304 days

Total

7

Last Release

744d ago

Major Versions

v1.2.3 → v2.02024-06-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/131a1ad4ca05898c6f3224ae01ad7d7118a3bc41b455f631a6be50660eceffe2?d=identicon)[qdequippe](/maintainers/qdequippe)

---

Top Contributors

[![qdequippe](https://avatars.githubusercontent.com/u/3193300?v=4)](https://github.com/qdequippe "qdequippe (13 commits)")[![sadikoff](https://avatars.githubusercontent.com/u/213810?v=4)](https://github.com/sadikoff "sadikoff (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![jderusse](https://avatars.githubusercontent.com/u/578547?v=4)](https://github.com/jderusse "jderusse (3 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (1 commits)")

---

Tags

oauthoauth2phpsymfonyAuthenticationSSOidentityoauthoauth2authorizationidpsingle sign onSymfonyConnect

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/qdequippe-oauth2-symfony-connect/health.svg)

```
[![Health](https://phpackages.com/badges/qdequippe-oauth2-symfony-connect/health.svg)](https://phpackages.com/packages/qdequippe-oauth2-symfony-connect)
```

###  Alternatives

[calcinai/oauth2-xero

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

103.4M4](/packages/calcinai-oauth2-xero)[adam-paterson/oauth2-slack

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

22749.0k10](/packages/adam-paterson-oauth2-slack)

PHPackages © 2026

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