PHPackages                             drbiko/slim-oauth2-http - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. drbiko/slim-oauth2-http

ActiveLibrary[HTTP &amp; Networking](/categories/http)

drbiko/slim-oauth2-http
=======================

Bridge components for PSR-7 and bshaffer's OAuth2 Server http messages.

v3.1.8(7y ago)01.9kMITPHPPHP ^5.6 || ^7.0

Since Jul 15Pushed 7y agoCompare

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

READMEChangelogDependencies (5)Versions (24)Used By (0)

Chadicus\\Slim\\OAuth2\\Http
============================

[](#chadicusslimoauth2http)

[![Build Status](https://camo.githubusercontent.com/fd72474d3bfdaeb1b62422cc594affe4c130ac14c3846f73a35b1bb581fb7691/68747470733a2f2f7472617669732d63692e6f72672f63686164696375732f736c696d2d6f61757468322d687474702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/chadicus/slim-oauth2-http)[![Code Quality](https://camo.githubusercontent.com/9b8b8e25d1b2a8b425334beb5c5028b1042b323ead75a76ffe879b3a6d990626/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f63686164696375732f736c696d2d6f61757468322d687474702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/chadicus/slim-oauth2-http/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/5a4fd11c56593231aaf804418a89ed739afbcba6ae7fb0cd0ede7bd595e634bf/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f63686164696375732f736c696d2d6f61757468322d687474702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/chadicus/slim-oauth2-http?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/356f9b550d8900639708f9b632eb8a4e0efb51f60a7e96fc909afe99bc8979b1/68747470733a2f2f706f7365722e707567782e6f72672f63686164696375732f736c696d2d6f61757468322d687474702f762f737461626c65)](https://packagist.org/packages/chadicus/slim-oauth2-http)[![Latest Unstable Version](https://camo.githubusercontent.com/d9695733fcb46589dc10b94816e6c3eaad83f311b318733c2d42fbcdc409e826/68747470733a2f2f706f7365722e707567782e6f72672f63686164696375732f736c696d2d6f61757468322d687474702f762f756e737461626c65)](https://packagist.org/packages/chadicus/slim-oauth2-http)[![License](https://camo.githubusercontent.com/5e8a65ff0b3094a5bbc97f2b63f054bf41b8e681d3f9e4d613ba9e218236fdcb/68747470733a2f2f706f7365722e707567782e6f72672f63686164696375732f736c696d2d6f61757468322d687474702f6c6963656e7365)](https://packagist.org/packages/chadicus/slim-oauth2-http)

[![Total Downloads](https://camo.githubusercontent.com/8a0f47c9d8547e1477f33804b121ce970ceb25a3e8a5b7e0bc6b1156b109314a/68747470733a2f2f706f7365722e707567782e6f72672f63686164696375732f736c696d2d6f61757468322d687474702f646f776e6c6f616473)](https://packagist.org/packages/chadicus/slim-oauth2-http)[![Daily Downloads](https://camo.githubusercontent.com/495056521cd0d442705bea8db4249487292dd73eaf98d82e29ff7972c7ea58b1/68747470733a2f2f706f7365722e707567782e6f72672f63686164696375732f736c696d2d6f61757468322d687474702f642f6461696c79)](https://packagist.org/packages/chadicus/slim-oauth2-http)[![Monthly Downloads](https://camo.githubusercontent.com/c1d1bf0a46eee61f9121b780fa32b5b86d4dc6beb3a783eb1d77559a5add7c89/68747470733a2f2f706f7365722e707567782e6f72672f63686164696375732f736c696d2d6f61757468322d687474702f642f6d6f6e74686c79)](https://packagist.org/packages/chadicus/slim-oauth2-http)

[![Documentation](https://camo.githubusercontent.com/a5445bbf0a3a04a2ec4db113f8a4ada4e12b57d9b2de32d936fa17800bc9ca6e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7265666572656e63652d706870646f632d626c75652e7376673f7374796c653d666c6174)](http://pholiophp.org/chadicus/slim-oauth2-http)

Static utilitiy classes to bridge [PSR-7](http://www.php-fig.org/psr/psr-7/) http messages to [OAuth2 Server](http://bshaffer.github.io/oauth2-server-php-docs/) requests and responses. While this libray is entended for use with [Slim 3](http://www.slimframework.com/), it should work with any PSR-7 compatible framework.

Requirements
------------

[](#requirements)

Chadicus\\Slim\\OAuth2\\Http requires PHP 5.6 (or later).

Composer
--------

[](#composer)

To add the library as a local, per-project dependency use [Composer](http://getcomposer.org)! Simply add a dependency on `chadicus/slim-oauth2-http` to your project's `composer.json` file such as:

```
composer require chadicus/slim-oauth2-http
```

Contact
-------

[](#contact)

Developers may be contacted at:

- [Pull Requests](https://github.com/chadicus/slim-oauth2-http/pulls)
- [Issues](https://github.com/chadicus/slim-oauth2-http/issues)

Project Build
-------------

[](#project-build)

With a checkout of the code get [Composer](http://getcomposer.org) in your PATH and run:

```
composer install
./vendor/bin/phpunit
./vendor/bin/phpcs
```

Community
---------

[](#community)

[![Gitter](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/slim-oauth2/Lobby#)

Available Operations
--------------------

[](#available-operations)

### Convert a PSR-7 request to an OAuth2 request

[](#convert-a-psr-7-request-to-an-oauth2-request)

```
use Chadicus\Slim\OAuth2\Http\RequestBridge;

$oauth2Request = RequestBridge::toOAuth2($psrRequest);
```

### Convert an OAuth2 response to a PSR-7 response.

[](#convert-an-oauth2-response-to-a-psr-7-response)

```
use Chadicus\Slim\OAuth2\Http\ResponseBridge;

$psr7Response = ResponseBridge::fromOAuth2($oauth2Request);
```

Example Integeration
--------------------

[](#example-integeration)

### Simple route for creating a new oauth2 access token

[](#simple-route-for-creating-a-new-oauth2-access-token)

```
use Chadicus\Slim\OAuth2\Http\RequestBridge;
use Chadicus\Slim\OAuth2\Http\ResponseBridge;
use OAuth2;
use OAuth2\GrantType;
use OAuth2\Storage;
use Slim;

$storage = new Storage\Memory(
    [
        'client_credentials' => [
            'testClientId' => [
                'client_id' => 'testClientId',
                'client_secret' => 'testClientSecret',
            ],
        ],
    ]
);

$server = new OAuth2\Server(
    $storage,
    [
        'access_lifetime' => 3600,
    ],
    [
        new GrantType\ClientCredentials($storage),
    ]
);

$app = new Slim\App();

$app->post('/token', function ($psrRequest, $psrResponse, array $args) use ($app, $server) {
    //create an \OAuth2\Request from the current \Slim\Http\Request Object
    $oauth2Request = RequestBridge::toOAuth2($psrRequest);

    //Allow the oauth2 server instance to handle the oauth2 request
    $oauth2Response = $server->handleTokenRequest($oauth2Request),

    //Map the oauth2 response into the slim response
    return ResponseBridge::fromOAuth2($oauth2Response);
});
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 94.3% 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 ~61 days

Recently: every ~124 days

Total

23

Last Release

2592d ago

Major Versions

v0.1.5 → v1.0.02016-02-03

v1.0.0 → v3.0.02016-05-22

v1.0.1 → v3.1.02016-11-15

v3.1.6 → 4.x-dev2018-01-07

PHP version history (5 changes)v0.1.0PHP ~5.4 || ~7.0

v1.0.0PHP ~5.5 || ~7.0

v3.0.0PHP ~5.6 || ~7.0

v3.1.0PHP ^5.6 || ^7.0

4.x-devPHP ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f252dd9b69af363b1c85d0f6739fc831c5fe7affe53212dff8ead0d85f099f0?d=identicon)[drbiko](/maintainers/drbiko)

---

Top Contributors

[![chadicus](https://avatars.githubusercontent.com/u/1182337?v=4)](https://github.com/chadicus "chadicus (115 commits)")[![dschreck](https://avatars.githubusercontent.com/u/2351265?v=4)](https://github.com/dschreck "dschreck (3 commits)")[![drbiko](https://avatars.githubusercontent.com/u/48100596?v=4)](https://github.com/drbiko "drbiko (2 commits)")[![mrceperka](https://avatars.githubusercontent.com/u/22822651?v=4)](https://github.com/mrceperka "mrceperka (2 commits)")

---

Tags

httpresponserequestmessagepsr7slimoauth2Bridge

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/drbiko-slim-oauth2-http/health.svg)

```
[![Health](https://phpackages.com/badges/drbiko-slim-oauth2-http/health.svg)](https://phpackages.com/packages/drbiko-slim-oauth2-http)
```

###  Alternatives

[psr/http-factory

PSR-17: Common interfaces for PSR-7 HTTP message factories

1.9k692.9M1.9k](/packages/psr-http-factory)[chadicus/slim-oauth2-http

Bridge components for PSR-7 and bshaffer's OAuth2 Server http messages.

18455.2k7](/packages/chadicus-slim-oauth2-http)[aplus/http

Aplus Framework HTTP Library

2311.6M10](/packages/aplus-http)[contributte/psr7-http-message

PSR-7 (HTTP Message Interface) to Nette Framework

222.9M8](/packages/contributte-psr7-http-message)[pdeans/http

PSR-7 cURL HTTP client with support for PSR-17 HTTP factories.

1466.2k3](/packages/pdeans-http)[workerman/psr7

PSR-7 message implementation that also provides common utility methods

1079.8k10](/packages/workerman-psr7)

PHPackages © 2026

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