PHPackages                             ofbeaton/oauth2-phabricator - 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. ofbeaton/oauth2-phabricator

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

ofbeaton/oauth2-phabricator
===========================

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

2.0.1(4y ago)8503[2 PRs](https://github.com/ofbeaton/oauth2-phabricator/pulls)MITPHPPHP &gt;=5.5.0

Since Nov 20Pushed 3y ago3 watchersCompare

[ Source](https://github.com/ofbeaton/oauth2-phabricator)[ Packagist](https://packagist.org/packages/ofbeaton/oauth2-phabricator)[ RSS](/packages/ofbeaton-oauth2-phabricator/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (7)Dependencies (4)Versions (10)Used By (0)

Phabricator Provider for OAuth 2.0 Client
=========================================

[](#phabricator-provider-for-oauth-20-client)

[![Latest Version](https://camo.githubusercontent.com/da18b7db5604b43fbfa3d20f7fe44a84a957cfa1775bddfbf57f770e3920dd1a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6f66626561746f6e2f6f61757468322d7068616272696361746f722e7376673f7374796c653d666c61742d737175617265)](https://github.com/ofbeaton/oauth2-phabricator/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/e1a5310d4dbb31d5e604fafc8b419477cee218a87f7d47d0439b67c6117095a6/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6f66626561746f6e2f6f61757468322d7068616272696361746f722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/ofbeaton/oauth2-phabricator)[![Coverage Status](https://camo.githubusercontent.com/9ed2c85f42d0ebc24db8da18e24797ff623a519d98558b1f4f82fb314bcbba25/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6f66626561746f6e2f6f61757468322d7068616272696361746f722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ofbeaton/oauth2-phabricator/code-structure)[![Quality Score](https://camo.githubusercontent.com/458dbba41a220742ae547dbcf70569921ba0ed6d057414211c7c3e95296402c7/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6f66626561746f6e2f6f61757468322d7068616272696361746f722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/ofbeaton/oauth2-phabricator)[![Total Downloads](https://camo.githubusercontent.com/3f29f0c34e97ec7aa835c72d3c75ec7c079da0f6ea744fab01f994a4c5f36aaa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f66626561746f6e2f6f61757468322d7068616272696361746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ofbeaton/oauth2-phabricator)

This package provides [Phabricator](https://www.phacility.com/) OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

Updates
-------

[](#updates)

The project is considered in a usable state and feature complete.

This project is used in corporate applications. As such, the authors are unlikely to update it on a regular basis, but instead when the corporate applications that use it run into problems. You should expect updates in the 5-10yr range.

Issues and PRs will be monitored, and we will continue to work with the community to provide updates as they are contributed.

Installation
------------

[](#installation)

To install, use composer:

```
composer require ofbeaton/oauth2-phabricator

```

Usage
-----

[](#usage)

Usage is the same as The League's OAuth client, using `\Ofbeaton\OAuth2\Client\Provider\Phabricator` as the provider.

### With oauth2-client bundles

[](#with-oauth2-client-bundles)

[Symfony Bundles](http://symfony.com/) like [knpuniversity's oauth2-client-bundle](https://github.com/knpuniversity/oauth2-client-bundle) or [HWIOAuthBundle](https://github.com/hwi/HWIOAuthBundle) use the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client) under the hood.

It is vital that you pass the domain for your phabricator install. For knpuniversity's oauth2-client-bundle this means in your Symfony `config.yml` you want this instead:

```
knpu_oauth2_client:
   clients:
      phabricator_oauth:
         type: generic
         provider_class: Ofbeaton\OAuth2\Client\Provider\Phabricator

         provider_options:
            domain: %phab_host%

         client_id: %phab_client_id%
         client_secret: %phab_client_secret%
         redirect_route: connect_phabricator_check
         redirect_params: {}
```

### Authorization Code Flow

[](#authorization-code-flow)

```
$provider = new Ofbeaton\OAuth2\Client\Provider\Phabricator([
    'domain'            => 'https://your-phabricator-install.com',
    'clientId'          => '{phabricator-client-id}',
    'clientSecret'      => '{phabricator-client-secret}',
    'redirectUri'       => 'https://your-application.com/callback-url',
]);

if (!isset($_GET['code'])) {

    // If we don't have an authorization code then get one
    $authUrl = $provider->getAuthorizationUrl();
    $_SESSION['oauth2state'] = $provider->getState();
    header('Location: '.$authUrl);
    exit;

// Check given state against previously stored one to mitigate CSRF attack
} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) {

    unset($_SESSION['oauth2state']);
    exit('Invalid state');

} else {

    // Try to get an access token (using the authorization code grant)
    $token = $provider->getAccessToken('authorization_code', [
        'code' => $_GET['code']
    ]);

    // Optional: Now you have a token you can look up a users profile data
    try {

        // We got an access token, let's now get the user's details
        $user = $provider->getResourceOwner($token);

        // Use these details to create a new profile
        printf('Hello %s!', $user->getRealName());

    } catch (Exception $e) {

        // Failed to get user details
        exit('Oh dear...');
    }

    // Use this to interact with an API on the users behalf
    echo $token->getToken();
}
```

### Managing Scopes

[](#managing-scopes)

When creating your Phabricator authorization URL, you can specify the state and scopes your application may authorize.

```
$options = [
    'state' => 'OPTIONAL_CUSTOM_CONFIGURED_STATE',
    'scope' => ['user','user:email','repo'] // array or string
];

$authorizationUrl = $provider->getAuthorizationUrl($options);
```

If neither are defined, the provider will utilize internal defaults.

At the time of authoring this documentation, [no scopes are available](https://secure.phabricator.com/book/phabcontrib/article/using_oauthserver/).

Testing
-------

[](#testing)

```
$ ./vendor/bin/phpunit
```

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

[](#contributing)

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

Credits
-------

[](#credits)

- [Finlay Beaton](https://ofbeaton.com)
- [Sammy Kaye Powers](https://github.com/SammyK) (through code from [oauth2-facebook](https://github.com/thephpleague/oauth2-facebook))
- [Steven Maguire](https://github.com/stevenmaguire) (through code from [oauth2-github](https://github.com/thephpleague/oauth2-github))
- [All Contributors](https://github.com/ofbeaton/oauth2-phabricator/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/ofbeaton/oauth2-phabricator/blob/master/LICENSE) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 86.7% 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 ~326 days

Recently: every ~488 days

Total

7

Last Release

1505d ago

Major Versions

0.1.0 → 1.0.02016-11-21

1.0.3 → 2.0.02016-11-22

### Community

Maintainers

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

---

Top Contributors

[![ofbeaton](https://avatars.githubusercontent.com/u/1781089?v=4)](https://github.com/ofbeaton "ofbeaton (26 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![CarlSchwan](https://avatars.githubusercontent.com/u/23653902?v=4)](https://github.com/CarlSchwan "CarlSchwan (1 commits)")[![jayvdb](https://avatars.githubusercontent.com/u/15092?v=4)](https://github.com/jayvdb "jayvdb (1 commits)")

---

Tags

oauthoauth-provideroauth2phabricatorphpphp-leagueclientoauthoauth2authorizationauthorisationphabricator

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/ofbeaton-oauth2-phabricator/health.svg)

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

###  Alternatives

[stevenmaguire/oauth2-keycloak

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

2275.9M27](/packages/stevenmaguire-oauth2-keycloak)[patrickbussmann/oauth2-apple

Sign in with Apple OAuth 2.0 Client Provider for The PHP League OAuth2-Client

1132.5M6](/packages/patrickbussmann-oauth2-apple)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[omines/oauth2-gitlab

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

36721.5k13](/packages/omines-oauth2-gitlab)

PHPackages © 2026

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