PHPackages                             mrgswift/oauth2-base-library - 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. mrgswift/oauth2-base-library

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

mrgswift/oauth2-base-library
============================

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

4.2.4(2y ago)0511MITPHPPHP ^7.3.0|^8.2CI failing

Since Sep 21Pushed 2y ago1 watchersCompare

[ Source](https://github.com/mrgswift/oauth2-base-library)[ Packagist](https://packagist.org/packages/mrgswift/oauth2-base-library)[ Docs](http://oauth2.thephpleague.com/)[ RSS](/packages/mrgswift-oauth2-base-library/feed)WikiDiscussions master Synced yesterday

READMEChangelog (7)Dependencies (5)Versions (9)Used By (1)

PHP OAuth 2.0 Server by [@alexbilbie](https://twitter.com/alexbilbie)
=====================================================================

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

[![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://camo.githubusercontent.com/b916b61a090e82fbcc73f8435fe82b0852b3e73f675511abf0d9e8141bfadeee/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7468657068706c65616775652f6f61757468322d7365727665722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/thephpleague/oauth2-server)[![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) [![Gitter](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/thephpleague/oauth2-server?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

A standards compliant [OAuth 2.0](http://tools.ietf.org/wg/oauth/draft-ietf-oauth-v2/) authorization server and resource 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.

It supports out of the box the following grants:

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

You can also define your own grants.

In addition it supports the following token types:

- Bearer tokens
- MAC tokens
- JSON web tokens (coming soon)

You can also create you own tokens.

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

[](#requirements)

The following versions of PHP are supported:

- PHP 5.4
- PHP 5.5
- PHP 5.6
- HHVM

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

[](#documentation)

This library has [full documentation](http://oauth2.thephpleague.com), powered by [Jekyll](http://jekyllrb.com/).

Contribute to this documentation in the [gh-pages branch](https://github.com/thephpleague/oauth2-server/tree/gh-pages/).

Changelog
---------

[](#changelog)

[See the project releases page](https://github.com/thephpleague/oauth2-server/releases)

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

[](#contributing)

Please see [CONTRIBUTING](https://github.com/thephpleague/oauth2-server/blob/master/CONTRIBUTING.md) for details.

Integration
-----------

[](#integration)

- [CakePHP 3](https://github.com/uafrica/oauth-server)
- [Laravel](https://github.com/lucadegasperi/oauth2-server-laravel)

Support
-------

[](#support)

Bugs and feature request are tracked on [GitHub](https://github.com/thephpleague/oauth2-server/issues)

Security
--------

[](#security)

If you discover any security related issues, please email  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 [Alex Bilbie](https://twitter.com/alexbilbie).

Special thanks to:

- [Dan Horrigan](https://github.com/dandoescode)
- [Nick Jackson](https://github.com/jacksonj04)
- [Michael Gooden](https://github.com/MichaelGooden)
- [Phil Sturgeon](https://github.com/philsturgeon)
- [and all the other contributors](https://github.com/thephpleague/oauth2-server/contributors)

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

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 100% 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 ~268 days

Recently: every ~308 days

Total

8

Last Release

912d ago

PHP version history (3 changes)4.1.7PHP &gt;=5.4.0

4.2.0PHP ^7.3.0

4.2.3PHP ^7.3.0|^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2319364?v=4)[Matthew Guillot](/maintainers/mrgswift)[@mrgswift](https://github.com/mrgswift)

---

Top Contributors

[![mrgswift](https://avatars.githubusercontent.com/u/2319364?v=4)](https://github.com/mrgswift "mrgswift (13 commits)")

---

Tags

apiauthAuthenticationserveroauthoauth2authorizationoauth 2.0secureresourceprotectauthorisationoauth 2

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mrgswift-oauth2-base-library/health.svg)

```
[![Health](https://phpackages.com/badges/mrgswift-oauth2-base-library/health.svg)](https://phpackages.com/packages/mrgswift-oauth2-base-library)
```

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