PHPackages                             depotwarehouse/oauth2-bnet - 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. depotwarehouse/oauth2-bnet

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

depotwarehouse/oauth2-bnet
==========================

A Battle.net provider for league/oauth2-client

5.0.2(10y ago)192.6k15[5 issues](https://github.com/tpavlek/oauth2-bnet/issues)[1 PRs](https://github.com/tpavlek/oauth2-bnet/pulls)1MITPHPPHP &gt;=5.5.0

Since Sep 11Pushed 5y ago3 watchersCompare

[ Source](https://github.com/tpavlek/oauth2-bnet)[ Packagist](https://packagist.org/packages/depotwarehouse/oauth2-bnet)[ RSS](/packages/depotwarehouse-oauth2-bnet/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (2)Versions (14)Used By (1)

Battle.net provider for league/oauth2-client
============================================

[](#battlenet-provider-for-leagueoauth2-client)

This is a package to integrate Battle.net authentication with the OAuth2 client library by [The League of Extraordinary Packages](https://github.com/thephpleague/oauth2-client).

Currently integrated with OAuth to pull profiles from SC2 &amp; WoW. If Diablo players submit a PR, I'd be happy to merge in changes and be inclusive :) Thanks to [@TheJaydox](https://github.com/TheJaydox)for submitting a WoW pull!

To install, use composer:

```
composer require depotwarehouse/oauth2-bnet
```

Usage is the same as the league's OAuth client, using `\Depotwarehouse\OAuth2\Client\Provider\SC2Provider` or `\Depotwarehouse\OAuth2\Client\Provider\WowProvider` as the provider. For example:

```
$provider = new \Depotwarehouse\OAuth2\Client\Provider\SC2Provider([
    'clientId' => "YOUR_CLIENT_ID",
    'clientSecret' => "YOUR_CLIENT_SECRET",
    'redirectUri' => "http://your-redirect-uri",
    'region' => 'eu'
]);
```

As you can see you may pass an optional 'region' argument to the constructor, and it will then query on that region instead. If you omit the region argument, then it will default to the `us` region.

```
if (isset($_GET['code']) && $_GET['code']) {
    $token = $this->provider->getAccessToken("authorizaton_code", [
        'code' => $_GET['code']
    ]);

    // Returns an instance of Depotwarehouse\OAuth2\Client\Entity\SC2User
    $user = $this->provider->getResourceOwner($token);
```

To get to know the data available on an `SC2User` simply inspect the public properties of the class, as they show all the available data that has been returned.

Alternatively, for WoW you can use `\Depotwarehouse\OAuth2\Client\Provider\WowProvider` and it will return an object of type `WowUser`. A `WowUser` simply contains a public `$data` property with an array of character objects as `stdClass`s.

There's an example JSON representation below, but I suggest you use inspection to figure out more closely what you're looking for (and maybe send a pull request with the properties you find!)

Example output (converted to JSON for display):

```
// $user->
{
    "data": [
    {
        "name": "Thejaydox",
        "realm": "Stormreaver",
        "battlegroup": "Rampage",
        "class": 4,
        "race": 10,
        "gender": 1,
        "level": 88,
        "achievementPoints": 16330,
        "thumbnail": "stormreaver\/230\/89809638-avatar.jpg",
        "spec": {
            "name": "Assassination",
            "role": "DPS",
            "backgroundImage": "bg-rogue-assassination",
            "icon": "ability_rogue_eviscerate",
            "description": "A deadly master of poisons who dispatches victims with vicious dagger strikes.",
            "order": 0
        },
        "guild": "Honnouji Academy",
        "guildRealm": "Stormreaver",
        "lastModified": 1421373438000
    },
    ]
}
```

Testing
-------

[](#testing)

There is a simple scaffold for an integration test in `test/`. Unfortunately, it is nontrivial to use, as the Battle.net OAuth service *requires* the use of `https` for all authentication traffic (but that does bode well for security!)

Included is an SSL certificate as well as a private key for use with the domain `oauth2-bnet.local`. Simply add `oauth2-bnet.local`to your `/etc/hosts` as an alias for localhost, and configure apache to serve the files in `test/` using the certificate and key files in `test/ssl`.

Next edit `test/config.php` to fill in the values for your own client key from  and you should be able to run the test. The page should redirect you to log in, and then dump your user values to screen if successful.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 90.9% 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 ~52 days

Recently: every ~81 days

Total

12

Last Release

3674d ago

Major Versions

1.1.2 → 2.0.02015-02-26

2.0.1 → 3.0.02015-05-20

3.0.1 → 4.02015-08-20

4.0 → 5.0.02015-09-29

### Community

Maintainers

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

---

Top Contributors

[![tpavlek](https://avatars.githubusercontent.com/u/782576?v=4)](https://github.com/tpavlek "tpavlek (20 commits)")[![andrecastelo](https://avatars.githubusercontent.com/u/726360?v=4)](https://github.com/andrecastelo "andrecastelo (1 commits)")[![rakeev](https://avatars.githubusercontent.com/u/1861570?v=4)](https://github.com/rakeev "rakeev (1 commits)")

### Embed Badge

![Health badge](/badges/depotwarehouse-oauth2-bnet/health.svg)

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

###  Alternatives

[tymon/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

11.5k49.1M344](/packages/tymon-jwt-auth)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

2509.6M48](/packages/thenetworg-oauth2-azure)[spatie/laravel-login-link

Quickly login to your local environment

4381.2M1](/packages/spatie-laravel-login-link)[andrewdwallo/filament-companies

A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.

34450.0k2](/packages/andrewdwallo-filament-companies)[thathoff/kirby-oauth

Kirby OAuth 2 Plugin

3823.9k](/packages/thathoff-kirby-oauth)

PHPackages © 2026

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