PHPackages                             imjarek/oauth2-server - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. imjarek/oauth2-server

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

imjarek/oauth2-server
=====================

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

v8.1.2(5y ago)02.1k1MITPHPPHP &gt;=7.2.0

Since Aug 27Pushed 5y agoCompare

[ Source](https://github.com/imjarek/oauth2-server)[ Packagist](https://packagist.org/packages/imjarek/oauth2-server)[ Docs](https://oauth2.thephpleague.com/)[ GitHub Sponsors](https://github.com/sephster)[ RSS](/packages/imjarek-oauth2-server/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (9)Versions (94)Used By (1)

PHP OAuth 2.0 Server
====================

[](#php-oauth-20-server)

[![Latest Version](https://camo.githubusercontent.com/07374488d628793eb4be22229129e52f084200d135bf3c5a010fc977e5332a36/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c65616775652f6f61757468322d7365727665722e7376673f7374796c653d666c61742d737175617265)](https://github.com/thephpleague/oauth2-server/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://github.com/thephpleague/oauth2-server/workflows/tests/badge.svg)](https://github.com/thephpleague/oauth2-server/actions)[![Coverage Status](https://camo.githubusercontent.com/4d19482eb9b0faee73dd2f8cab55c349f1eac3113f2cf4838a5e2630f9065c22/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7468657068706c65616775652f6f61757468322d7365727665722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/thephpleague/oauth2-server/code-structure)[![Quality Score](https://camo.githubusercontent.com/5bbb71f2086c51eda336d8f4629178eb670b1c4058b39d07b9cda56125f95d5a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7468657068706c65616775652f6f61757468322d7365727665722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/thephpleague/oauth2-server)[![Total Downloads](https://camo.githubusercontent.com/a78ed55a3198bcb7603d0635eeaa157c19cdd0b7561aed7e238fc35e9c51fa03/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c65616775652f6f61757468322d7365727665722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/league/oauth2-server)[![PHPStan](https://camo.githubusercontent.com/a44af5fc39484990738cc4bd3874d884a42afdeed470b34a010e77bb8341ef31/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d656e61626c65642d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/phpstan/phpstan)

`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.

Out of the box it supports the following grants:

- Authorization code grant
- Implicit grant
- Client credentials grant
- Resource owner password credentials grant
- Refresh grant

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)

This library was created by Alex Bilbie. Find him on Twitter at [@alexbilbie](https://twitter.com/alexbilbie).

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

[](#requirements)

The following versions of PHP are supported:

- PHP 7.2
- PHP 7.3
- PHP 7.4

The `openssl` and `json` extensions are also required.

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.

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

[](#installation)

```
composer require league/oauth2-server

```

Documentation
-------------

[](#documentation)

The library documentation can be found at . You can contribute to the documentation in the [gh-pages branch](https://github.com/thephpleague/oauth2-server/tree/gh-pages/).

Testing
-------

[](#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
vendor/bin/phpstan analyse -l 7 -c phpstan.neon src tests

```

Continuous Integration
----------------------

[](#continuous-integration)

We use [Github Actions](https://github.com/features/actions), [Scrutinizer](https://scrutinizer-ci.com/), and [StyleCI](https://styleci.io/) for continuous integration. Check out [our](https://github.com/thephpleague/oauth2-server/blob/master/.github/workflows/tests.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
----------------------

[](#community-integrations)

- [Drupal](https://www.drupal.org/project/simple_oauth)
- [Laravel Passport](https://github.com/laravel/passport)
- [OAuth 2 Server for CakePHP 3](https://github.com/uafrica/oauth-server)
- [OAuth 2 Server for Mezzio](https://github.com/mezzio/mezzio-authentication-oauth2)
- [Trikoder OAuth 2 Bundle (Symfony)](https://github.com/trikoder/oauth2-bundle)
- [Heimdall for CodeIgniter 4](https://github.com/ezralazuardy/heimdall)

Changelog
---------

[](#changelog)

See the [project changelog](https://github.com/thephpleague/oauth2-server/blob/master/CHANGELOG.md)

Contributing
------------

[](#contributing)

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.

Support
-------

[](#support)

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.

Security
--------

[](#security)

If you discover any security related issues, please email `andrew@noexceptions.io` instead of using the issue tracker.

License
-------

[](#license)

This package is released under the MIT License. See the bundled [LICENSE](https://github.com/thephpleague/oauth2-server/blob/master/LICENSE) file for details.

Credits
-------

[](#credits)

This code is principally developed and maintained by [Andy Millington](https://twitter.com/Sephster).

Between 2012 and 2017 this library was developed and maintained by [Alex Bilbie](https://alexbilbie.com/).

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).

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.

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.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 73.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.

###  Release Activity

Cadence

Every ~33 days

Recently: every ~144 days

Total

90

Last Release

1988d ago

Major Versions

5.1.5 → 6.0.12017-07-19

5.1.x-dev → 6.1.02017-12-23

6.1.1 → 7.0.02018-02-18

4.1.x-dev → 7.2.02018-06-23

7.4.0 → 8.0.02019-07-13

PHP version history (7 changes)0.2PHP &gt;=5.3.0

3.0PHP &gt;=5.4.0

5.0.0-RC1PHP &gt;=5.5.9

6.0.0PHP &gt;=5.6.0

7.0.0PHP &gt;=7.0.0

8.0.0PHP &gt;=7.1.0

8.1.0PHP &gt;=7.2.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10037816?v=4)[Sergey](/maintainers/imjarek)[@imjarek](https://github.com/imjarek)

---

Top Contributors

[![alexbilbie](https://avatars.githubusercontent.com/u/77991?v=4)](https://github.com/alexbilbie "alexbilbie (1691 commits)")[![Sephster](https://avatars.githubusercontent.com/u/1457058?v=4)](https://github.com/Sephster "Sephster (402 commits)")[![juliangut](https://avatars.githubusercontent.com/u/1104131?v=4)](https://github.com/juliangut "juliangut (56 commits)")[![lookyman](https://avatars.githubusercontent.com/u/3863468?v=4)](https://github.com/lookyman "lookyman (14 commits)")[![iansltx](https://avatars.githubusercontent.com/u/472804?v=4)](https://github.com/iansltx "iansltx (11 commits)")[![dhrrgn](https://avatars.githubusercontent.com/u/149921?v=4)](https://github.com/dhrrgn "dhrrgn (11 commits)")[![erickjth](https://avatars.githubusercontent.com/u/287978?v=4)](https://github.com/erickjth "erickjth (11 commits)")[![filecage](https://avatars.githubusercontent.com/u/698854?v=4)](https://github.com/filecage "filecage (11 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (10 commits)")[![toopay](https://avatars.githubusercontent.com/u/534245?v=4)](https://github.com/toopay "toopay (7 commits)")[![vinkla](https://avatars.githubusercontent.com/u/499192?v=4)](https://github.com/vinkla "vinkla (6 commits)")[![fizzka](https://avatars.githubusercontent.com/u/2384736?v=4)](https://github.com/fizzka "fizzka (6 commits)")[![Hywan](https://avatars.githubusercontent.com/u/946104?v=4)](https://github.com/Hywan "Hywan (6 commits)")[![MichaelGooden](https://avatars.githubusercontent.com/u/1275012?v=4)](https://github.com/MichaelGooden "MichaelGooden (5 commits)")[![uphlewis](https://avatars.githubusercontent.com/u/43346009?v=4)](https://github.com/uphlewis "uphlewis (5 commits)")[![ceeram](https://avatars.githubusercontent.com/u/111448?v=4)](https://github.com/ceeram "ceeram (5 commits)")[![lucadegasperi](https://avatars.githubusercontent.com/u/820687?v=4)](https://github.com/lucadegasperi "lucadegasperi (5 commits)")[![JC5](https://avatars.githubusercontent.com/u/5889984?v=4)](https://github.com/JC5 "JC5 (5 commits)")[![michaelhogg](https://avatars.githubusercontent.com/u/6292810?v=4)](https://github.com/michaelhogg "michaelhogg (5 commits)")[![michalbundyra](https://avatars.githubusercontent.com/u/7423207?v=4)](https://github.com/michalbundyra "michalbundyra (4 commits)")

---

Tags

apiauthAuthenticationserveroauthoauth2authorizationoauth 2.0secureresourceprotectauthorisationoauth 2

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/imjarek-oauth2-server/health.svg)

```
[![Health](https://phpackages.com/badges/imjarek-oauth2-server/health.svg)](https://phpackages.com/packages/imjarek-oauth2-server)
```

###  Alternatives

[league/oauth2-server

A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.

6.6k136.0M248](/packages/league-oauth2-server)[chervand/yii2-oauth2-server

OAuth 2.0 server for Yii 2.0 with MAC tokens support.

1524.2k1](/packages/chervand-yii2-oauth2-server)[ezralazuardy/heimdall

Painless OAuth 2.0 Server for CodeIgniter 4

454.2k](/packages/ezralazuardy-heimdall)[auth0/auth0-php

PHP SDK for Auth0 Authentication and Management APIs.

40820.2M68](/packages/auth0-auth0-php)[auth0/login

Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.

2745.0M3](/packages/auth0-login)[auth0/symfony

Symfony SDK for Auth0 Authentication and Management APIs.

128738.1k](/packages/auth0-symfony)

PHPackages © 2026

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