PHPackages                             jk/oauth2-php - 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. jk/oauth2-php

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

jk/oauth2-php
=============

OAuth2 Draft 20 server implementation

0.20.1(11y ago)151.5k4MITPHPPHP &gt;= 5.3.13

Since Jan 19Pushed 11y ago1 watchersCompare

[ Source](https://github.com/jk/oauth2-php)[ Packagist](https://packagist.org/packages/jk/oauth2-php)[ Docs](https://github.com/jk/oauth2-php)[ RSS](/packages/jk-oauth2-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

[![OAuth 2 logo](https://github.com/jk/oauth2-php/raw/master/Icon.png "OAuth 2 logo")](https://github.com/jk/oauth2-php/raw/master/Icon.png)

OAuth2 PHP implementation
=========================

[](#oauth2-php-implementation)

This implementation consists of a server and client.

The `master` branch implements the [IETF OAuth 2.0 Draft 10](http://tools.ietf.org/html/draft-ietf-oauth-v2-10) specification. You should proabably take a look at the `draft-20` branch for the latest and greatest code. [Draft 20](http://tools.ietf.org/html/draft-ietf-oauth-v2-20) was marked to be ready to implement and should be the last draft of OAuth 2.0 before it goes RFC. The `draft-20` branch aims to implement the [Bearer Token Draft](http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer) and perhaps in the future even the [MAC Token Draft](http://tools.ietf.org/wg/oauth/draft-ietf-oauth-v2-http-mac/).

Requirments
-----------

[](#requirments)

- A recent version of PHP5 (tested on PHP 5.3.5)
- PDO supported SQL backend (tested with MySQL 5.5.9), if you want to use the PDO example
- but you can implement the IOAuth2\* interfaces under the `lib` directory by your self (there is no reason, why a NoSQL backend shouldn't be working)

How to setup the OAuth 2 server component
-----------------------------------------

[](#how-to-setup-the-oauth-2-server-component)

Please have look in `server/examples/pdo` directory. This should be working with a MySQL server. You can find the scheme SQL under `server/examples/pdo/mysql_create_tables.sql` and adjust the PDO dsn in `server/examples/pdo/config.php`.

References
----------

[](#references)

- [Official OAuth 2.0 website](http://oauth.net/2/)
- [Latest IETF OAuth 2 Draft](http://tools.ietf.org/html/draft-ietf-oauth-v2) ([Draft 20](http://tools.ietf.org/html/draft-ietf-oauth-v2-20), [Draft 10](http://tools.ietf.org/html/draft-ietf-oauth-v2-10))
- [Latest IETF OAuth 2 Bearer Token Draft](http://tools.ietf.org/html/draft-ietf-oauth-v2-bearer)
- [Latest IETF OAuth 2 MAC Token Draft](http://tools.ietf.org/wg/oauth/draft-ietf-oauth-v2-http-mac/)

Licensing
---------

[](#licensing)

This repository is released under the MIT licence. Check `LICENSE.txt` for more detail.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~2 days

Total

2

Last Release

4135d ago

### Community

Maintainers

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

---

Top Contributors

[![jk](https://avatars.githubusercontent.com/u/40043?v=4)](https://github.com/jk "jk (22 commits)")[![hswong3i](https://avatars.githubusercontent.com/u/780562?v=4)](https://github.com/hswong3i "hswong3i (14 commits)")[![opendining](https://avatars.githubusercontent.com/u/645450?v=4)](https://github.com/opendining "opendining (8 commits)")[![aaronpk](https://avatars.githubusercontent.com/u/113001?v=4)](https://github.com/aaronpk "aaronpk (2 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jk-oauth2-php/health.svg)

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

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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