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

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

depotwarehouse/oauth2-twitch
============================

A Twitch provider for league/oauth2-client

1.3.3(6y ago)18152.6k↓44%12[4 issues](https://github.com/tpavlek/oauth2-twitch/issues)[3 PRs](https://github.com/tpavlek/oauth2-twitch/pulls)MITPHPCI failing

Since Feb 2Pushed 4y ago5 watchersCompare

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

READMEChangelog (10)Dependencies (1)Versions (13)Used By (0)

Twitch provider for league/oauth2-client
========================================

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

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

To install, use composer:

```
composer require depotwarehouse/oauth2-twitch
```

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

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

You can also optionally add a `scopes` key to the array passed to the constructor. The available scopes are documented on the [Twitch API Documentation](https://github.com/justintv/Twitch-API/blob/master/authentication.md).

> Note: The provider uses the "user\_read" scope by default. If you pass other scopes, and want the -&gt;getResourceOwner() method to work, you will need to ensure the "user\_read" scope is used.

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

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

    $user->getDisplayName();
    $user->getId()
    $user->getType();
    $user->getBio();
    $user->getEmail();
    $user->getPartnered();
```

Testing
-------

[](#testing)

You can quickly test that the package works by adding client information (from your twitch.tv account) to `config/config.php`and then starting up a php server

```
cd test/
php -S localhost:8000
```

Now, navigating to `http://localhost:8000` should present an OAuth flow and then dump your user information.

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 52.8% 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 ~171 days

Recently: every ~399 days

Total

11

Last Release

2453d ago

### 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 (19 commits)")[![0plus1](https://avatars.githubusercontent.com/u/420815?v=4)](https://github.com/0plus1 "0plus1 (13 commits)")[![ThePooN](https://avatars.githubusercontent.com/u/4985725?v=4)](https://github.com/ThePooN "ThePooN (2 commits)")[![medienopfer](https://avatars.githubusercontent.com/u/1210592?v=4)](https://github.com/medienopfer "medienopfer (1 commits)")[![rohimma](https://avatars.githubusercontent.com/u/2255417?v=4)](https://github.com/rohimma "rohimma (1 commits)")

### Embed Badge

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

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

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[thenetworg/oauth2-azure

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

25310.7M82](/packages/thenetworg-oauth2-azure)[league/oauth2-google

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

42223.4M176](/packages/league-oauth2-google)[stevenmaguire/oauth2-keycloak

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

2306.4M45](/packages/stevenmaguire-oauth2-keycloak)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[patrickbussmann/oauth2-apple

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

1152.8M12](/packages/patrickbussmann-oauth2-apple)

PHPackages © 2026

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