2016-04-10 21:01:05 +05:30
# PHP OAuth 2.0 Server
2013-12-06 03:02:29 +05:30
2014-10-01 03:42:43 +05:30
[![Latest Version ](http://img.shields.io/packagist/v/league/oauth2-server.svg?style=flat-square )](https://github.com/thephpleague/oauth2-server/releases)
2014-10-03 19:12:01 +05:30
[![Software License ](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square )](LICENSE.md)
2014-10-01 03:42:43 +05:30
[![Build Status ](https://img.shields.io/travis/thephpleague/oauth2-server/master.svg?style=flat-square )](https://travis-ci.org/thephpleague/oauth2-server)
[![Coverage Status ](https://img.shields.io/scrutinizer/coverage/g/thephpleague/oauth2-server.svg?style=flat-square )](https://scrutinizer-ci.com/g/thephpleague/oauth2-server/code-structure)
[![Quality Score ](https://img.shields.io/scrutinizer/g/thephpleague/oauth2-server.svg?style=flat-square )](https://scrutinizer-ci.com/g/thephpleague/oauth2-server)
2016-02-22 16:34:03 +05:30
[![Total Downloads ](https://img.shields.io/packagist/dt/league/oauth2-server.svg?style=flat-square )](https://packagist.org/packages/league/oauth2-server)
2018-02-18 19:50:37 +05:30
[![PHPStan ](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat-square )](https://github.com/phpstan/phpstan)
2013-12-06 03:02:29 +05:30
2016-12-23 04:00:54 +05:30
`league/oauth2-server` is a standards compliant implementation of an [OAuth 2.0 ](https://tools.ietf.org/html/rfc6749 ) authorization server written in PHP which makes working with OAuth 2.0 trivial. You can easily configure an OAuth 2.0 server to protect your API with access tokens, or allow clients to request new access tokens and refresh them.
2012-06-05 01:46:27 +05:30
2018-02-18 20:58:28 +05:30
Out of the box it supports the following grants:
2012-06-05 01:46:27 +05:30
2014-10-01 03:42:43 +05:30
* Authorization code grant
2016-02-22 16:34:03 +05:30
* Implicit grant
2014-10-01 03:42:43 +05:30
* Client credentials grant
* Resource owner password credentials grant
* Refresh grant
2012-08-27 20:13:17 +05:30
2016-05-06 19:53:25 +05:30
The following RFCs are implemented:
* [RFC6749 "OAuth 2.0" ](https://tools.ietf.org/html/rfc6749 )
* [RFC6750 " The OAuth 2.0 Authorization Framework: Bearer Token Usage" ](https://tools.ietf.org/html/rfc6750 )
* [RFC7519 "JSON Web Token (JWT)" ](https://tools.ietf.org/html/rfc7519 )
* [RFC7636 "Proof Key for Code Exchange by OAuth Public Clients" ](https://tools.ietf.org/html/rfc7636 )
2016-04-10 21:01:05 +05:30
This library was created by Alex Bilbie. Find him on Twitter at [@alexbilbie ](https://twitter.com/alexbilbie ).
2012-08-27 20:13:17 +05:30
2014-10-01 03:42:43 +05:30
## Requirements
2013-12-19 18:03:39 +05:30
2014-10-01 03:42:43 +05:30
The following versions of PHP are supported:
2013-12-19 18:03:39 +05:30
2017-02-02 22:59:06 +05:30
* PHP 7.1
2017-12-14 02:35:36 +05:30
* PHP 7.2
2018-12-07 05:16:28 +05:30
* PHP 7.3
2013-12-19 18:03:39 +05:30
2019-05-12 00:07:22 +05:30
The `openssl` and `json` extensions are also required.
2012-08-27 20:13:17 +05:30
2018-06-08 15:49:27 +05:30
All HTTP messages passed to the server should be [PSR-7 compliant ](https://www.php-fig.org/psr/psr-7/ ). This ensures interoperability with other packages and frameworks.
2018-05-16 18:06:29 +05:30
2018-02-18 19:50:37 +05:30
## Installation
```
composer require league/oauth2-server
```
2014-10-01 03:42:43 +05:30
## Documentation
2012-08-27 20:13:17 +05:30
2018-02-18 19:50:37 +05:30
The library documentation can be found at [https://oauth2.thephpleague.com ](https://oauth2.thephpleague.com ).
2016-04-10 21:01:55 +05:30
You can contribute to the documentation in the [gh-pages branch ](https://github.com/thephpleague/oauth2-server/tree/gh-pages/ ).
2013-02-22 19:01:05 +05:30
2018-02-18 19:50:37 +05:30
## Testing
The library uses [PHPUnit ](https://phpunit.de/ ) for unit tests and [PHPStan ](https://github.com/phpstan/phpstan ) for static analysis of the code.
```
vendor/bin/phpunit
2018-02-19 01:47:32 +05:30
vendor/bin/phpstan analyse -l 7 -c phpstan.neon src tests
2018-02-18 19:50:37 +05:30
```
## Continous Integration
We use [Travis CI ](https://travis-ci.org/ ), [Scrutinizer ](https://scrutinizer-ci.com/ ), and [StyleCI ](https://styleci.io/ ) for continuous integration. Check out [our ](https://github.com/thephpleague/oauth2-server/blob/master/.travis.yml ) [configuration ](https://github.com/thephpleague/oauth2-server/blob/master/.scrutinizer.yml ) [files ](https://github.com/thephpleague/oauth2-server/blob/master/.styleci.yml ) if you'd like to know more.
## Community Integrations
2018-05-03 21:36:27 +05:30
* [Drupal ](https://www.drupal.org/project/simple_oauth )
2018-02-18 19:50:37 +05:30
* [Laravel Passport ](https://github.com/laravel/passport )
* [OAuth 2 Server for CakePHP 3 ](https://github.com/uafrica/oauth-server )
2018-09-19 15:32:06 +05:30
* [OAuth 2 Server for Expressive ](https://github.com/zendframework/zend-expressive-authentication-oauth2 )
2018-11-28 16:54:16 +05:30
* [Trikoder OAuth 2 Bundle (Symfony) ](https://github.com/trikoder/oauth2-bundle )
2018-02-18 19:50:37 +05:30
2013-09-26 15:48:10 +05:30
## Changelog
2012-08-27 20:13:17 +05:30
2018-02-18 20:59:59 +05:30
See the [project changelog ](https://github.com/thephpleague/oauth2-server/blob/master/CHANGELOG.md )
2012-08-27 20:13:17 +05:30
2013-09-26 15:48:10 +05:30
## Contributing
2012-08-27 20:13:17 +05:30
2018-04-22 17:28:05 +05:30
Contributions are always welcome. Please see [CONTRIBUTING.md ](https://github.com/thephpleague/oauth2-server/blob/master/CONTRIBUTING.md ) and [CODE_OF_CONDUCT.md ](https://github.com/thephpleague/oauth2-server/blob/master/CODE_OF_CONDUCT.md ) for details.
2013-07-24 22:44:48 +05:30
2013-09-26 15:48:10 +05:30
## Support
2013-07-24 22:44:48 +05:30
2016-02-22 16:34:03 +05:30
Bugs and feature request are tracked on [GitHub ](https://github.com/thephpleague/oauth2-server/issues ).
If you have any questions about OAuth _please_ open a ticket here; please **don't** email the address below.
2013-07-24 22:44:48 +05:30
2015-02-05 21:44:59 +05:30
## Security
2019-05-11 23:52:29 +05:30
If you discover any security related issues, please email `andrew@noexceptions.io` instead of using the issue tracker.
2015-02-05 21:44:59 +05:30
2013-09-26 15:48:10 +05:30
## License
2013-07-24 22:44:48 +05:30
2014-10-01 04:46:26 +05:30
This package is released under the MIT License. See the bundled [LICENSE ](https://github.com/thephpleague/oauth2-server/blob/master/LICENSE ) file for details.
2013-07-24 22:44:48 +05:30
2013-09-26 15:48:10 +05:30
## Credits
2013-07-24 22:44:48 +05:30
2018-02-18 19:50:37 +05:30
This code is principally developed and maintained by [Andy Millington ](https://twitter.com/Sephster ) and [Simon Hamp ](https://twitter.com/simonhamp ).
2012-09-07 16:29:41 +05:30
2017-10-28 16:59:55 +05:30
Between 2012 and 2017 this library was developed and maintained by [Alex Bilbie ](https://alexbilbie.com/ ).
2018-02-18 19:50:37 +05:30
PHP OAuth 2.0 Server is one of many packages provided by The PHP League. To find out more, please visit [our website ](https://thephpleague.com ).
2017-07-01 21:47:55 +05:30
Special thanks to [all of these awesome contributors ](https://github.com/thephpleague/oauth2-server/contributors ).
Additional thanks go to the [Mozilla Secure Open Source Fund ](https://wiki.mozilla.org/MOSS/Secure_Open_Source ) for funding a security audit of this library.
2013-12-06 02:50:48 +05:30
2014-08-06 22:46:16 +05:30
The initial code was developed as part of the [Linkey ](http://linkey.blogs.lincoln.ac.uk ) project which was funded by [JISC ](http://jisc.ac.uk ) under the Access and Identity Management programme.