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

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

abr4xas/oauth2-twitch
=====================

This is my package oauth2-twitch

v1.0.0(3y ago)16[1 PRs](https://github.com/abr4xas/oauth2-twitch/pulls)MITPHPPHP ^8.0

Since Oct 1Pushed 2y ago1 watchersCompare

[ Source](https://github.com/abr4xas/oauth2-twitch)[ Packagist](https://packagist.org/packages/abr4xas/oauth2-twitch)[ Docs](https://github.com/abr4xas/oauth2-twitch)[ GitHub Sponsors](https://github.com/abr4xas)[ RSS](/packages/abr4xas-oauth2-twitch/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

Twitch Helix Provider for OAuth 2.0 Client
------------------------------------------

[](#twitch-helix-provider-for-oauth-20-client)

---

[![Latest Version on Packagist](https://camo.githubusercontent.com/b110c3a6a9232f4cfffa66eadc806b0910b5b10959361aff03610163097ead8a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616272347861732f6f61757468322d7477697463682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abr4xas/oauth2-twitch)[![Tests](https://github.com/abr4xas/oauth2-twitch/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/abr4xas/oauth2-twitch/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/0dbaf86418c9defd4960031350e9e35d2baf5caa96fed44d96425a5653803010/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616272347861732f6f61757468322d7477697463682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abr4xas/oauth2-twitch)

This package provides Twitch (new version Helix) OAuth 2.0 support for the PHP League's [OAuth 2.0 Client](https://github.com/thephpleague/oauth2-client).

### Installation

[](#installation)

You can install the package via composer:

```
composer require abr4xas/oauth2-twitch
```

### Usage

[](#usage)

```
$twitch = new \Abr4xas\Oauth2Twitch\Provider\Twitch([
    'clientId' => "CLIENT_ID",
    'clientSecret' => "CLIENT_SECRET",
    'redirectUri' => "http://localhost:8000",
]);

// get the authorization url
$url = $twitch->getAuthorizationUrl();

// get user info
if (isset($_GET['code'])) {
    try {
        $token = $twitch->getAccessToken("authorization_code", [
            'code' => $_GET['code'],
        ]);

        $user = $twitch->getResourceOwner($token);

        $userData = $user->toArray();

        // get specific info from your user
        // $user->getDisplayName();
        // $userData->getId()
        // $userData->getType();
        // $userData->getBio();
        // $userData->getEmail();
        // $userData->getPartnered();

        print("".print_r($userData, true)."");
    } catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
    }
}
```

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

### Contributing

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

### Security Vulnerabilities

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

### Credits

[](#credits)

- [Angel](https://github.com/abr4xas)
- [All Contributors](../../contributors)

### License

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

1319d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6d947508ce4076ed67ec719eb2c74696e025dab397eabc921d483545fb4c403f?d=identicon)[abr4xas](/maintainers/abr4xas)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")[![abr4xas](https://avatars.githubusercontent.com/u/405484?v=4)](https://github.com/abr4xas "abr4xas (4 commits)")

---

Tags

hacktoberfestphptwitchabr4xasoauth2-twitch

###  Code Quality

TestsPest

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[league/oauth2-google

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

41721.2M118](/packages/league-oauth2-google)[knpuniversity/oauth2-client-bundle

Integration with league/oauth2-client to provide services

83416.7M61](/packages/knpuniversity-oauth2-client-bundle)[thenetworg/oauth2-azure

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

2509.6M48](/packages/thenetworg-oauth2-azure)[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)[microsoft/kiota-authentication-phpleague

Authentication provider for Kiota using the PHP League OAuth 2.0 client to authenticate against the Microsoft Identity platform

153.2M7](/packages/microsoft-kiota-authentication-phpleague)

PHPackages © 2026

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