PHPackages                             mathieu-dumoutier/oauth2-envconfig - 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. mathieu-dumoutier/oauth2-envconfig

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

mathieu-dumoutier/oauth2-envconfig
==================================

OAuth2 Client generic provider for config by .env file

041PHP

Since Jan 13Pushed 3y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

OAuth2 Client generic provider for config by .env file
======================================================

[](#oauth2-client-generic-provider-for-config-by-env-file)

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

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

[](#installation)

To install, use composer:

```
composer require mathieu-dumoutier/oauth2-envconfig

```

Usage
-----

[](#usage)

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

knpuniversity/oauth2-client-bundle configuration example
--------------------------------------------------------

[](#knpuniversityoauth2-client-bundle-configuration-example)

```
knpu_oauth2_client:
    clients:
        yourapp_oauth:
            type: generic
            provider_class: MathieuDumoutier\OAuth2\Client\Provider\EnvConfigProvider
            provider_options:
                "scopes": '%env(OAUTH2_SCOPES)%'
                "app_url": '%env(OAUTH2_BASE_APP_URL)%'
                "api_url": '%env(OAUTH2_BASE_API_URL)%'
            client_id: '%env(OAUTH2_CLIENT_ID)%'
            client_secret: '%env(OAUTH2_CLIENT_SECRET)%'
            redirect_route: oauth2_check
            redirect_params: {}
            use_state: false
```

You must define 6 environment variables :

- OAUTH2\_CLIENT\_ID
- OAUTH2\_CLIENT\_SECRET
- OAUTH2\_SCOPES (scopes would you want requested)
- OAUTH2\_BASE\_APP\_URL
- OAUTH2\_BASE\_API\_URL

You must create the route "oauth2\_check" in a controller :

```
#[Route('/oauth2_check', name: 'oauth2_check')]
public function oauth2Check(): void
{
    // This action is not executed because onAuthenticationSuccess() method of the OAuth2Authenticator class redirect before
}
```

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity23

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/7883b2c582d55dda0ef0c937bd91940105d128c102b0bcaf47879e257a9b7159?d=identicon)[neothone](/maintainers/neothone)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/mathieu-dumoutier-oauth2-envconfig/health.svg)

```
[![Health](https://phpackages.com/badges/mathieu-dumoutier-oauth2-envconfig/health.svg)](https://phpackages.com/packages/mathieu-dumoutier-oauth2-envconfig)
```

###  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)
