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

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

maksimovic/slim-oauth2-http
===========================

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

v4.0.1(3mo ago)02.0k3MITPHPPHP ^8.1CI passing

Since Jul 15Pushed 3mo agoCompare

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

READMEChangelog (2)Dependencies (4)Versions (29)Used By (3)

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

[](#chadicusslimoauth2http)

> **Fork Notice:** This is a maintained fork of the abandoned [`chadicus/slim-oauth2-http`](https://github.com/chadicus/slim-oauth2-http) package. Updated for PHP 8.1+ with support for `laminas/laminas-diactoros` v3.

Static utility 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 library is intended for use with [Slim](http://www.slimframework.com/), it should work with any PSR-7 compatible framework.

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

[](#requirements)

- PHP 8.1+
- [bshaffer/oauth2-server-php](https://github.com/bshaffer/oauth2-server-php) ^1.8
- [laminas/laminas-diactoros](https://github.com/laminas/laminas-diactoros) ^2.0 || ^3.0

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

[](#installation)

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

Usage
-----

[](#usage)

### 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($oauth2Response);
```

Example Integration
-------------------

[](#example-integration)

### 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 PSR-7 request
    $oauth2Request = RequestBridge::toOAuth2($psrRequest);

    // Let the OAuth2 server handle the request
    $oauth2Response = $server->handleTokenRequest($oauth2Request);

    // Map the OAuth2 response to a PSR-7 response
    return ResponseBridge::fromOAuth2($oauth2Response);
});
```

Development
-----------

[](#development)

```
composer install
composer test
composer test:coverage
composer cs-check
```

License
-------

[](#license)

[MIT](LICENSE)

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance82

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 89.6% 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 ~150 days

Recently: every ~562 days

Total

27

Last Release

98d 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

v3.3.0 → v4.0.02026-03-13

PHP version history (7 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

v3.2.0PHP ^5.6 || ^7.0 || ^8.0

v3.3.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/d43e10a649dca578689bc02aa4089e26c0d26b1a2f3640dda458973e55adcf10?d=identicon)[maksimovic](/maintainers/maksimovic)

---

Top Contributors

[![chadicus](https://avatars.githubusercontent.com/u/1182337?v=4)](https://github.com/chadicus "chadicus (129 commits)")[![maksimovic](https://avatars.githubusercontent.com/u/1126226?v=4)](https://github.com/maksimovic "maksimovic (6 commits)")[![dschreck](https://avatars.githubusercontent.com/u/2351265?v=4)](https://github.com/dschreck "dschreck (3 commits)")[![Copilot](https://avatars.githubusercontent.com/in/1143301?v=4)](https://github.com/Copilot "Copilot (2 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)")

---

Tags

httpresponserequestmessagepsr7slimoauth2Bridge

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[chadicus/slim-oauth2-http

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

18464.5k7](/packages/chadicus-slim-oauth2-http)[psr/http-factory

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

1.9k728.6M2.5k](/packages/psr-http-factory)[contributte/psr7-http-message

PSR-7 (HTTP Message Interface) to Nette Framework

233.0M9](/packages/contributte-psr7-http-message)[aplus/http

Aplus Framework HTTP Library

2331.6M10](/packages/aplus-http)[pdeans/http

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

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

PSR-7 message implementation that also provides common utility methods

1083.7k11](/packages/workerman-psr7)

PHPackages © 2026

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