{"id":19406271,"url":"https://github.com/chadicus/slim-oauth2-http","last_synced_at":"2025-04-24T09:31:03.186Z","repository":{"id":35003053,"uuid":"39095386","full_name":"chadicus/slim-oauth2-http","owner":"chadicus","description":"Bridge components for slim and oauth2 http messages.","archived":false,"fork":false,"pushed_at":"2023-05-09T18:49:33.000Z","size":906,"stargazers_count":18,"open_issues_count":2,"forks_count":10,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-19T14:41:13.532Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chadicus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-07-14T19:15:08.000Z","updated_at":"2023-05-09T18:21:54.000Z","dependencies_parsed_at":"2024-06-18T16:46:53.070Z","dependency_job_id":"23c5342e-d0be-4d55-a1f4-6ad30e77e6e3","html_url":"https://github.com/chadicus/slim-oauth2-http","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chadicus%2Fslim-oauth2-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chadicus%2Fslim-oauth2-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chadicus%2Fslim-oauth2-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chadicus%2Fslim-oauth2-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chadicus","download_url":"https://codeload.github.com/chadicus/slim-oauth2-http/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250600622,"owners_count":21456996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T11:41:49.271Z","updated_at":"2025-04-24T09:31:02.921Z","avatar_url":"https://github.com/chadicus.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Chadicus\\Slim\\OAuth2\\Http\n\n[![Build Status](https://travis-ci.org/chadicus/slim-oauth2-http.svg?branch=master)](https://travis-ci.org/chadicus/slim-oauth2-http)\n[![Code Quality](https://scrutinizer-ci.com/g/chadicus/slim-oauth2-http/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/chadicus/slim-oauth2-http/?branch=master)\n[![Code Coverage](https://coveralls.io/repos/github/chadicus/slim-oauth2-http/badge.svg?branch=master)](https://coveralls.io/github/chadicus/slim-oauth2-http?branch=master)\n\n[![Latest Stable Version](https://poser.pugx.org/chadicus/slim-oauth2-http/v/stable)](https://packagist.org/packages/chadicus/slim-oauth2-http)\n[![Latest Unstable Version](https://poser.pugx.org/chadicus/slim-oauth2-http/v/unstable)](https://packagist.org/packages/chadicus/slim-oauth2-http)\n[![License](https://poser.pugx.org/chadicus/slim-oauth2-http/license)](https://packagist.org/packages/chadicus/slim-oauth2-http)\n\n[![Total Downloads](https://poser.pugx.org/chadicus/slim-oauth2-http/downloads)](https://packagist.org/packages/chadicus/slim-oauth2-http)\n[![Daily Downloads](https://poser.pugx.org/chadicus/slim-oauth2-http/d/daily)](https://packagist.org/packages/chadicus/slim-oauth2-http)\n[![Monthly Downloads](https://poser.pugx.org/chadicus/slim-oauth2-http/d/monthly)](https://packagist.org/packages/chadicus/slim-oauth2-http)\n\n[![Documentation](https://img.shields.io/badge/reference-phpdoc-blue.svg?style=flat)](http://pholiophp.org/chadicus/slim-oauth2-http)\n\nStatic 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.\n\n## Requirements\n\nChadicus\\Slim\\OAuth2\\Http requires PHP 5.6 (or later).\n\n## Composer\nTo 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:\n\n```sh\ncomposer require chadicus/slim-oauth2-http\n```\n\n## Contact\nDevelopers may be contacted at:\n\n * [Pull Requests](https://github.com/chadicus/slim-oauth2-http/pulls)\n * [Issues](https://github.com/chadicus/slim-oauth2-http/issues)\n\n## Project Build\nWith a checkout of the code get [Composer](http://getcomposer.org) in your PATH and run:\n\n```sh\ncomposer install\n./vendor/bin/phpunit\n./vendor/bin/phpcs\n```\n\n## Community\n[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/slim-oauth2/Lobby#)\n\n## Available Operations\n\n### Convert a PSR-7 request to an OAuth2 request\n```php\nuse Chadicus\\Slim\\OAuth2\\Http\\RequestBridge;\n\n$oauth2Request = RequestBridge::toOAuth2($psrRequest);\n```\n\n### Convert an OAuth2 response to a PSR-7 response.\n```php\nuse Chadicus\\Slim\\OAuth2\\Http\\ResponseBridge;\n\n$psr7Response = ResponseBridge::fromOAuth2($oauth2Request);\n```\n\n## Example Integeration\n\n### Simple route for creating a new oauth2 access token\n```php\nuse Chadicus\\Slim\\OAuth2\\Http\\RequestBridge;\nuse Chadicus\\Slim\\OAuth2\\Http\\ResponseBridge;\nuse OAuth2;\nuse OAuth2\\GrantType;\nuse OAuth2\\Storage;\nuse Slim;\n\n$storage = new Storage\\Memory(\n    [\n        'client_credentials' =\u003e [\n            'testClientId' =\u003e [\n                'client_id' =\u003e 'testClientId',\n                'client_secret' =\u003e 'testClientSecret',\n            ],\n        ],\n    ]\n);\n\n$server = new OAuth2\\Server(\n    $storage,\n    [\n        'access_lifetime' =\u003e 3600,\n    ],\n    [\n        new GrantType\\ClientCredentials($storage),\n    ]\n);\n\n$app = new Slim\\App();\n\n$app-\u003epost('/token', function ($psrRequest, $psrResponse, array $args) use ($app, $server) {\n    //create an \\OAuth2\\Request from the current \\Slim\\Http\\Request Object\n    $oauth2Request = RequestBridge::toOAuth2($psrRequest);\n\n    //Allow the oauth2 server instance to handle the oauth2 request\n    $oauth2Response = $server-\u003ehandleTokenRequest($oauth2Request),\n\n    //Map the oauth2 response into the slim response\n    return ResponseBridge::fromOAuth2($oauth2Response);\n});\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchadicus%2Fslim-oauth2-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchadicus%2Fslim-oauth2-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchadicus%2Fslim-oauth2-http/lists"}