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

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

joakimkejser/oauth
==================

06

Since Jan 31Pushed 12y agoCompare

[ Source](https://github.com/aa6my/OAuth)[ Packagist](https://packagist.org/packages/joakimkejser/oauth)[ RSS](/packages/joakimkejser-oauth/feed)WikiDiscussions develop Synced 4d ago

READMEChangelogDependenciesVersions (3)Used By (0)

\#OAuth PSR2 Compliant OAuth 1.0 library base on **Andy Smith's** OAuth library found here:

[![Build Status](https://camo.githubusercontent.com/324a5f1bc46b920932ee473b2e9f3bef11eaa85ef87da6726ee464850de16e0a/68747470733a2f2f6170692e7472617669732d63692e6f72672f6a6f616b696d6b656a7365722f4f417574682e706e67)](https://travis-ci.org/joakimkejser/OAuth)

\##2-Legged OAuth Server Example

```
$request = JoakimKejser\OAuth\Request::createFromGlobals();

// Simple Example ConsumerStore using arrays
$consumerStore = new JoakimKejser\OAuth\ConsumerStore\ArrayConsumerStore(array('key' => 'secret', 'key2' => 'secret2'));

// Simple Example NonceStore using arrays - you should use a persistent store
$nonceStore = new JoakimKejser\OAuth\NonceStore\ArrayNonceStore();

// We don't need a TokenStore since we'll be doing Two Legged
$server = new JoakimKejser\OAuth\Server($request, $consumerStore, $nonceStore, null);

// Add the signature method you wanna support
$server->addSignatureMethod(new JoakimKejser\OAuth\SignatureMethod\HmacSha1);

try {
    list($consumer, $token) = $server->verifyRequest();
    echo "Welcome consumer with key: " . $consumer->key;
} catch (JoakimKejser\OAuth\Exception $e) {
    echo "Something went wrong: " . $e->getMessage();
}
```

\##2-Legged OAuth Client Example

```
$key = 'key';
$secret = 'secret';
$consumer = new JoakimKejser\OAuth\Consumer($key, $secret);

$sigMethod = new JoakimKejser\OAuth\SignatureMethod\HmacSha1;

$method = "POST";

//API endpoint to call
$api_endpoint = 'http://apiyouwanna/call';

//Create and sign the request - 2-Legged so token is null
$req = Request::createFromConsumerAndToken($consumer, $method, $api_endpoint, null);
$req->sign($sigMethod, $consumer, null); //Token is still null

$ch = curl_init();

$url = $req->getNormalizedHttpUrl();

// Get the URL for the GET request, without oauth parameters, as we'll add them to the Authorization header
if ($method == "GET") {
    $url = $req->toUrl(true);
}

// Set up CURL
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

// Add the Authorization header to the request
curl_setopt($ch, CURLOPT_HTTPHEADER, array($req->toHeader()));

// If it's post, add the post data
if ($method == "POST") {
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $req->toPostData(true));
}

// And go
$output = curl_exec($ch);

curl_close($ch);

echo $output;
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/5f35b7a28d0821c06813388ac7d391b3463c20d3325ef8025f0d7298f0123acb?d=identicon)[aa6my](/maintainers/aa6my)

---

Top Contributors

[![joakimkejser](https://avatars.githubusercontent.com/u/2860792?v=4)](https://github.com/joakimkejser "joakimkejser (23 commits)")[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (6 commits)")

### Embed Badge

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

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

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