PHPackages                             ogdev/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. ogdev/slim-oauth2-http

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

ogdev/slim-oauth2-http
======================

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

0338↓50%PHP

Since Feb 26Pushed 2mo agoCompare

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

READMEChangelogDependenciesVersions (1)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

24

—

LowBetter than 32% of packages

Maintenance56

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

Top contributor holds 87.2% 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/9b45631c74f84ce39d15e8ca4acd6f4c8f43701693c43e9594fa70714c97ca45?d=identicon)[ogdev](/maintainers/ogdev)

---

Top Contributors

[![chadicus](https://avatars.githubusercontent.com/u/1182337?v=4)](https://github.com/chadicus "chadicus (116 commits)")[![tchapi](https://avatars.githubusercontent.com/u/1944007?v=4)](https://github.com/tchapi "tchapi (5 commits)")[![admitriev-og](https://avatars.githubusercontent.com/u/199734805?v=4)](https://github.com/admitriev-og "admitriev-og (4 commits)")[![dschreck](https://avatars.githubusercontent.com/u/2351265?v=4)](https://github.com/dschreck "dschreck (3 commits)")[![mrceperka](https://avatars.githubusercontent.com/u/22822651?v=4)](https://github.com/mrceperka "mrceperka (2 commits)")[![svycka](https://avatars.githubusercontent.com/u/1270782?v=4)](https://github.com/svycka "svycka (2 commits)")[![savritsky](https://avatars.githubusercontent.com/u/5127886?v=4)](https://github.com/savritsky "savritsky (1 commits)")

### Embed Badge

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

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

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48347.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

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