PHPackages                             maye/oauth-client - 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. maye/oauth-client

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

maye/oauth-client
=================

PHP OAuth Client based on lusitanian/oauth

1.4.0(9y ago)11.5k1MITPHPPHP &gt;=5.6.0

Since Feb 14Pushed 9y ago1 watchersCompare

[ Source](https://github.com/kawanamiyuu/Maye.OAuthClient)[ Packagist](https://packagist.org/packages/maye/oauth-client)[ RSS](/packages/maye-oauth-client/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (5)Versions (8)Used By (1)

Maye.OAuthClient
================

[](#mayeoauthclient)

[![Build Status](https://camo.githubusercontent.com/40bdbf674f1da28dbc5906116d7b2fb512b0dd086b49f1bc2b0c0ca2c1662091/68747470733a2f2f7472617669732d63692e6f72672f6b6177616e616d697975752f4d6179652e4f41757468436c69656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kawanamiyuu/Maye.OAuthClient)

Maye.OAuthClient is the OAuth Client library which has simple interface to support [OAuth 1](https://github.com/Lusitanian/PHPoAuthLib/tree/master/src/OAuth/OAuth1/Service) and [OAuth 2](https://github.com/Lusitanian/PHPoAuthLib/tree/master/src/OAuth/OAuth2/Service), based on [lusitanian/oauth (PHPoAuthLib)](https://github.com/Lusitanian/PHPoAuthLib).

e.g. Twitter (OAuth1)
---------------------

[](#eg-twitter-oauth1)

### 1. Redirects to an authorization page

[](#1-redirects-to-an-authorization-page)

```
use Maye\OAuthClient;

define('CONSUMER_KEY', 'your twitter consumer key');
define('CONSUMER_SECRET', 'your twitter consumer secret');

$client = new OAuth1Client(
	'twitter',
	CONSUMER_KEY,
	CONSUMER_SECRET,
	'/oauth/twitter/callback'
);

// redirect
$client->authorize();
exit;
```

### 2. Called back after authorization process finished

[](#2-called-back-after-authorization-process-finished)

```
$denied = $_GET['denied'];
$oauthToken = $_GET['oauth_token'];
$oauthVerifier = $_GET['oauth_verifier'];

if (!empty($denied)) {
	// should be handled as error
	echo 'error';
	exit;
}

/** @var OAuth\OAuth1\Token\TokenInterface $token */
$token = $client->requestAccessToken($oauthToken, $oauthVerifier);

$accessToken       = $token->getAccessToken();
$accessTokenSecret = $token->getAccessTokenSecret();
$userId     = $token->getExtraParams()['user_id'];
$screenName = $token->getExtraParams()['screen_name'];

// gets the authorized user info
$result = $client->api('get', 'users/show.json', ['user_id' => $userId]);
$result = json_decode($result);

$name = $result->name;
```

e.g. Facebook (OAuth2)
----------------------

[](#eg-facebook-oauth2)

### 1. Redirects to authorization page

[](#1-redirects-to-authorization-page)

```
use Maye\OAuthClient;
use OAuth\OAuth2\Service\Facebook;

define('CONSUMER_KEY', 'your facebook consumer key');
define('CONSUMER_SECRET', 'your facebook consumer secret');

$client = new OAuth2Client(
	'facebook',
	CONSUMER_KEY,
	CONSUMER_SECRET,
	'/oauth/facebook/callback',
	[Facebook::SCOPE_READ_STREAM, Facebook::SCOPE_PUBLISH_ACTIONS]
);

// redirect
$client->authorize();
exit;
```

### 2. Called back after authorization process finished

[](#2-called-back-after-authorization-process-finished-1)

```
$code = $_GET['code'];

if (empty($code)) {
	// should be handled as error
	echo 'error';
	exit;
}

/** @var OAuth\OAuth2\Token\TokenInterface $token */
$token = $client->requestAccessToken($code);

$accessToken  = $token->getAccessToken();
$refreshToken = $token->getRefreshToken();

// gets the authorized user info
$result = $client->api('get', '/me');
$result = json_decode($result);

$id = $result->id;
$name = $result->name;
```

###  Health Score

30

—

LowBetter than 61% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Recently: every ~157 days

Total

7

Last Release

3569d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.5.0

1.4.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/83cb12b2e0fa43bb9ec62e161039cc7226b0077a631b62d0b25e9e6c00b46a1d?d=identicon)[kawanamiyuu](/maintainers/kawanamiyuu)

---

Top Contributors

[![kawanamiyuu](https://avatars.githubusercontent.com/u/1461463?v=4)](https://github.com/kawanamiyuu "kawanamiyuu (56 commits)")

---

Tags

oauth

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/maye-oauth-client/health.svg)

```
[![Health](https://phpackages.com/badges/maye-oauth-client/health.svg)](https://phpackages.com/packages/maye-oauth-client)
```

###  Alternatives

[artdarek/oauth-4-laravel

OAuth Service Provider for Laravel 4

678518.3k](/packages/artdarek-oauth-4-laravel)[oriceon/oauth-5-laravel

OAuth Service Provider for Laravel 5

1741.6M](/packages/oriceon-oauth-5-laravel)[nodge/yii2-eauth

Yii2 EAuth Extension. EAuth allows to authenticate users with accounts on other websites (Google, Facebook, Twitter, etc).

191103.8k](/packages/nodge-yii2-eauth)[oryzone/oauth-user-data

Extension library for Lusitanian/PHPoAuthLib to extract user profile data from various oAuth providers

4560.2k](/packages/oryzone-oauth-user-data)[jenssegers/oauth

Laravel OAuth library based on Lusitanian/PHPoAuthLib

6718.6k](/packages/jenssegers-oauth)[mmanos/laravel-social

A social login package for Laravel 4.

556.8k](/packages/mmanos-laravel-social)

PHPackages © 2026

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