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

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

texthtml/oauth2-provider
========================

OAuth2 provider for the Symfony Security component

v1.5.1(9y ago)54.3k2[1 PRs](https://github.com/texthtml/oauth2-provider/pulls)MITPHP

Since Dec 21Pushed 1y ago1 watchersCompare

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

READMEChangelog (7)Dependencies (7)Versions (11)Used By (0)

Oauth2 Provider
===============

[](#oauth2-provider)

[![Build Status](https://camo.githubusercontent.com/d98b0d82e762232fd839247782f50752f61322f5d23f42bc9dc68fea01f51d64/68747470733a2f2f7472617669732d63692e6f72672f7465787468746d6c2f6f61757468322d70726f76696465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/texthtml/oauth2-provider)[![Latest Stable Version](https://camo.githubusercontent.com/34938e76f65bef1981bd21900b5a16d55c53345262c879bf72ee236d605e6f11/68747470733a2f2f706f7365722e707567782e6f72672f7465787468746d6c2f6f61757468322d70726f76696465722f762f737461626c652e737667)](https://packagist.org/packages/texthtml/oauth2-provider)[![License](https://camo.githubusercontent.com/bfdb53fef5860d8a4bf0cdec11f9b252f1626cf8bf2a28b0a9de37f50fc6ca65/68747470733a2f2f706f7365722e707567782e6f72672f7465787468746d6c2f6f61757468322d70726f76696465722f6c6963656e73652e737667)](https://packagist.org/packages/texthtml/oauth2-provider)[![Total Downloads](https://camo.githubusercontent.com/8d9f6910d89cbc58de5cca8dcbe72e805fbde597de4ad1f1279d1d4364108bf6/68747470733a2f2f706f7365722e707567782e6f72672f7465787468746d6c2f6f61757468322d70726f76696465722f646f776e6c6f6164732e737667)](https://packagist.org/packages/texthtml/oauth2-provider)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/404b82a96ec9cb749dc42808a64a9055b2fec6d4d3918a6bf6955c3381665f58/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7465787468746d6c2f6f61757468322d70726f76696465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/texthtml/oauth2-provider/?branch=master)

OAuth2 Provider is a provider for Symfony Security component that can be used to build OAuth2 protected applications

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

[](#installation)

With Composer :

```
composer require texthtml/oauth2-provider
```

Usage with Silex 2
------------------

[](#usage-with-silex-2)

There is a Pimple provider you can use to secure Silex apps. You need to install Silex 2: `composer require silex/silex "^2.0"`

```
$app = new Silex\Application;

$oAuth2Provider = new TH\OAuth2\Pimple\OAuth2ServerProvider;
$app['security.entry_point.api.oauth2.realm'] = 'My App';
$app->register($oAuth2Provider, [
    'oauth2_server.storage.client' => function () use ($config) {
        return new TH\OAuth2\Storage\Memory\ClientMemoryStorage([
            'NICE_DEV_CLIENT' => [
                'name' => 'Nice Dev Client',
                'redirect_uri' => 'http://..../my_oauth2_callback',
            ],
        ]);
    },
    'oauth2_server.storage.pdo_connection' => function(Application $app) {
        return new PDO('...');
    },
]);
$app->mount('/auth/', $oAuth2Provider);

$app['users.provider'] = [
    // raw password is foo
    'admin' => array('ROLE_ADMIN', '5FZ2Z8QIkA7UTZ4BYkoC+GsReLf569mSKDsfods6LYQ8t+a8EW9oaircfMpmaLbPBh4FOBiiFyLfuZmTSUwzZg=='),
];

$app->register(new Silex\Provider\SecurityServiceProvider, [
    'security.firewalls' => [
        'oauth.token' => [
            'pattern' => '^/auth/token',
            'security' => false,
        ],
        'oauth.authorize' => [
            'pattern' => '^/auth/authorize',
            'http' => true,
            'users' => $app['users.provider'],
        ],
        'api' => [
            'pattern' => '^/api',
            'stateless' => true,
            'oauth2' => true,
            'security' => true,
            'users' => $app['users.provider'],
        ],
    ],
]);
```

Usage with other frameworks
---------------------------

[](#usage-with-other-frameworks)

This package can be used with any framework using the Symfony Security component (eg: Symfony, Laravel, Silex, etc.). But the provider `TH\OAuth2\Pimple\OAuth2ServerProvider` only works for Silex 2. For other frameworks you'll have to manually register the services and mount the routes.

PRs for providers for such frameworks are welcome!

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 84% 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 ~96 days

Recently: every ~109 days

Total

8

Last Release

3487d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3943b5c35797d1ede53aaed3d6812e4cf5b2dba7619a00dc7a381480a7b3d330?d=identicon)[mathroc](/maintainers/mathroc)

---

Top Contributors

[![mathroc](https://avatars.githubusercontent.com/u/291531?v=4)](https://github.com/mathroc "mathroc (21 commits)")[![tontonAurel](https://avatars.githubusercontent.com/u/1333803?v=4)](https://github.com/tontonAurel "tontonAurel (4 commits)")

---

Tags

oauth2silexsymfony

### Embed Badge

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

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

###  Alternatives

[filsh/yii2-oauth2-server

OAuth2 Server for PHP

331523.9k12](/packages/filsh-yii2-oauth2-server)[bshaffer/oauth2-server-bundle

Symfony OAuth2ServerBundle

106201.1k1](/packages/bshaffer-oauth2-server-bundle)[bshaffer/oauth2-server-httpfoundation-bridge

A bridge to HttpFoundation for oauth2-server-php

522.3M12](/packages/bshaffer-oauth2-server-httpfoundation-bridge)[chadicus/slim-oauth2-middleware

OAuth2 middleware for use within a Slim Framework API

48411.9k1](/packages/chadicus-slim-oauth2-middleware)[foskym/flarum-oauth-center

Allow user to authorize the third clients

221.4k](/packages/foskym-flarum-oauth-center)[davec49/silex2-simpleuser

A simple database-backed user provider for Silex 2.0, with associated services and controllers forked from jasongrimes/SimpleUser.

131.1k](/packages/davec49-silex2-simpleuser)

PHPackages © 2026

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