PHPackages                             btafoya/ohmy-auth - 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. btafoya/ohmy-auth

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

btafoya/ohmy-auth
=================

OAuth so easy.. you won't even believe it's OAuth

0.0.8(11y ago)054New BSDPHPPHP &gt;=5.3.0

Since Jan 31Pushed 11y agoCompare

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

READMEChangelogDependenciesVersions (9)Used By (0)

ohmy-auth [![Build Status](https://camo.githubusercontent.com/a510c97a29e53ab98761475c0905151470a8b87d1bd059e3c35c13bf05db8759/68747470733a2f2f7472617669732d63692e6f72672f7375646f636f64652f6f686d792d617574682e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/sudocode/ohmy-auth) [![Scrutinizer Quality Score](https://camo.githubusercontent.com/adb465b5a604b1f1b552ff8f6c26ecf05d77a89793ef11a705125b0cd53b7770/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7375646f636f64652f6f686d792d617574682f6261646765732f7175616c6974792d73636f72652e706e673f733d30646238666232303431306632383938306438353930373435333132393537353232623731663065)](https://scrutinizer-ci.com/g/sudocode/ohmy-auth/) [![License](https://camo.githubusercontent.com/350c3f9126a3277e93099700901ee239ebb3f2fc1f30acacc9d46caee522b2dc/68747470733a2f2f706f7365722e707567782e6f72672f6f686d792f617574682f6c6963656e73652e706e67)](https://packagist.org/packages/ohmy/auth)
=================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#ohmy-auth---)

ohmy-auth (Oma) is a PHP library that simplifies OAuth into a fluent interface:

```
use ohmy\Auth1;
Auth1::legs(2)
     ->set('key', 'key')
     ->set('secret', 'secret')
     ->request('http://term.ie/oauth/example/request_token.php')
     ->access('http://term.ie/oauth/example/access_token.php')
     ->GET('http://term.ie/oauth/example/echo_api.php')
     ->then(function($data) {
         # got data
     });
```

### Dependencies

[](#dependencies)

Oma only requires PHP (&gt;= 5.3) and the usual extensions for Curl (`curl_init()`, `curl_setopt()`, etc), JSON (`json_encode()`, `json_decode()`) and sessions (`session_start()`, `session_destroy()`).

### Installing with Composer

[](#installing-with-composer)

The best way to install Oma is via Composer. Just add `ohmy/auth` to your project's `composer.json` and run `composer install`. eg:

```
{
    "require": {
        "btafoya/ohmy-auth": "*"
    }
}
```

### Installing manually

[](#installing-manually)

If you prefer not to use Composer, you can download an archive or clone this repo and put `src/ohmy` into your project setup.

### Two-Legged OAuth 1.0a

[](#two-legged-oauth-10a)

```
use ohmy\Auth1;

# do 2-legged oauth
$termie = Auth1::legs(2)
               # configuration
               ->set('key', 'key')
               ->set('secret', 'secret')
               # oauth flow
               ->request('http://term.ie/oauth/example/request_token.php')
               ->access('http://term.ie/oauth/example/access_token.php');

# api call
$termie->GET('http://term.ie/oauth/example/echo_api.php')
       ->then(function($data) {
           # got data
       });
```

### Three-Legged OAuth 1.0a

[](#three-legged-oauth-10a)

*Note: This requires sessions in order to save data between redirects. This will not work properly without sessions!*

```
use ohmy\Auth1;

# do 3-legged oauth
$tumblr = Auth1::legs(3)
               # configuration
               ->set(array(
                    'consumer_key'    => 'your_consumer_key',
                    'consumer_secret' => 'your_consumer_secret',
                    'callback'        => 'your_callback_url'
               ))
               # oauth flow
               ->request('http://www.tumblr.com/oauth/request_token')
               ->authorize('http://www.tumblr.com/oauth/authorize')
               ->access('http://www.tumblr.com/oauth/access_token');

# access tumblr api
$tumblr->GET('https://api.tumblr.com/v2/user/info')
       ->then(function($data) {
           # got user data
       });
```

### Three-Legged OAuth 2.0

[](#three-legged-oauth-20)

```
use ohmy\Auth2;

# do 3-legged oauth
$github = Auth2::legs(3)
               # configuration
               ->set(array(
                    'id'       => 'your_github_client_id',
                    'secret'   => 'your_github_client_secret',
                    'redirect' => 'your_redirect_uri'
               ))
               # oauth flow
               ->authorize('https://github.com/login/oauth/authorize')
               ->access('https://github.com/login/oauth/access_token')
               ->finally(function($data) use(&$access_token) {
                   $access_token = $data['access_token'];
               });

# access github api
$github->GET("https://api.github.com/user?access_token=$access_token", null, array('User-Agent' => 'ohmy-auth'))
       ->then(function($data) {
           # got user data
       });
```

### More examples

[](#more-examples)

- [Facebook](https://github.com/sudocode/ohmy-auth/blob/master/examples/facebook.php)
- [Fitbit](https://github.com/sudocode/ohmy-auth/blob/master/examples/fitbit.php)
- [GitHub](https://github.com/sudocode/ohmy-auth/blob/master/examples/github.php)
- [Google+](https://github.com/sudocode/ohmy-auth/blob/master/examples/google.php)
- [Instagram](https://github.com/sudocode/ohmy-auth/blob/master/examples/instagram.php)
- [LinkedIn](https://github.com/sudocode/ohmy-auth/blob/master/examples/linkedin.php)
- [Live](https://github.com/sudocode/ohmy-auth/blob/master/examples/live.php)
- [Tumblr](https://github.com/sudocode/ohmy-auth/blob/master/examples/tumblr.php)
- [Twitter](https://github.com/sudocode/ohmy-auth/blob/master/examples/twitter.php)
- [Yahoo](https://github.com/sudocode/ohmy-auth/blob/master/examples/yahoo.php)

### Licenses

[](#licenses)

- **PHP license**: PHP License
- **ohmy-auth**: New BSD License.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

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

###  Release Activity

Cadence

Every ~53 days

Recently: every ~94 days

Total

8

Last Release

4106d ago

### Community

Maintainers

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

---

Top Contributors

[![dotprodcom](https://avatars.githubusercontent.com/u/102049552?v=4)](https://github.com/dotprodcom "dotprodcom (74 commits)")[![sudocode](https://avatars.githubusercontent.com/u/522221?v=4)](https://github.com/sudocode "sudocode (39 commits)")[![btafoya](https://avatars.githubusercontent.com/u/4192106?v=4)](https://github.com/btafoya "btafoya (2 commits)")

---

Tags

oauth

### Embed Badge

![Health badge](/badges/btafoya-ohmy-auth/health.svg)

```
[![Health](https://phpackages.com/badges/btafoya-ohmy-auth/health.svg)](https://phpackages.com/packages/btafoya-ohmy-auth)
```

###  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)[league/oauth2-client

OAuth 2.0 Client Library

3.8k118.6M1.2k](/packages/league-oauth2-client)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[knpuniversity/oauth2-client-bundle

Integration with league/oauth2-client to provide services

83416.7M61](/packages/knpuniversity-oauth2-client-bundle)[socialiteproviders/manager

Easily add new or override built-in providers in Laravel Socialite.

42442.0M544](/packages/socialiteproviders-manager)[league/oauth2-google

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

41721.2M118](/packages/league-oauth2-google)

PHPackages © 2026

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