PHPackages                             fuziion/riot-games-sso - 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. fuziion/riot-games-sso

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

fuziion/riot-games-sso
======================

A simple and efficient PHP package for implementing Riot Games SSO authentication. Works with any PHP framework (Laravel, Symfony, CodeIgniter) or plain PHP projects.

v1.0.0(5mo ago)01MITPHPPHP ^8.1

Since Jan 18Pushed 5mo agoCompare

[ Source](https://github.com/REFUZIION/riot-games-sso)[ Packagist](https://packagist.org/packages/fuziion/riot-games-sso)[ RSS](/packages/fuziion-riot-games-sso/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Riot Games SSO for PHP
======================

[](#riot-games-sso-for-php)

[![Latest Version](https://camo.githubusercontent.com/fcd6b14b8ecc3a8d65514c052f3d79431ff74e16fd80b90ebf2885ed7527f1e0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f66757a69696f6e2f72696f742d67616d65732d73736f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fuziion/riot-games-sso)[![Total Downloads](https://camo.githubusercontent.com/c4084cbfc80cbf5c570756e5aa87c7c4e7b60921771ec4190cd385bd30dac0a0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f66757a69696f6e2f72696f742d67616d65732d73736f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fuziion/riot-games-sso)[![License](https://camo.githubusercontent.com/62489587e7c02e4b42f755d87bb3e9c1528a1108ab2f41f14c345f6a7e8fd970/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f66757a69696f6e2f72696f742d67616d65732d73736f2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fuziion/riot-games-sso)

A simple and efficient PHP package for implementing Riot Games SSO (Single Sign-On) authentication. Works with **any PHP project** including Laravel, Symfony, CodeIgniter, or plain PHP. This package uses native PHP cURL, requiring no external HTTP client dependencies.

Features
--------

[](#features)

- ✅ **Zero Dependencies** - Uses native PHP cURL, no Guzzle or other HTTP clients required
- ✅ **Laravel Integration** - Seamless integration with Laravel via Service Provider and Facade
- ✅ **Framework Agnostic** - Can be used in any PHP project
- ✅ **Simple API** - Clean and intuitive methods for OAuth flow
- ✅ **Error Handling** - Comprehensive exception handling
- ✅ **Type Safe** - Full type hints and return types

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

[](#installation)

Install the package via Composer:

```
composer require fuziion/riot-games-sso
```

Quick Start
-----------

[](#quick-start)

### Plain PHP / Framework Agnostic Usage

[](#plain-php--framework-agnostic-usage)

The package works out of the box in any PHP project. Simply instantiate the class with your credentials:

> 💡 **Tip:** See `EXAMPLE_STANDALONE.php` for a complete working example in a standalone PHP project.

```
require 'vendor/autoload.php';

use Fuziion\RiotGamesSSO\RiotGames;
use Fuziion\RiotGamesSSO\Exceptions\RiotGamesException;

// Initialize with your credentials
$riotGames = new RiotGames(
    clientId: 'your_client_id',
    clientSecret: 'your_client_secret'
);

try {
    // Step 1: Get authorization URL and redirect user
    $authUrl = $riotGames->getAuthorizationUrl('https://yourapp.com/callback');
    header("Location: {$authUrl}");
    exit;

    // Step 2: Handle callback (after user authorizes)
    $code = $_GET['code'] ?? null;
    if ($code) {
        $accessToken = $riotGames->getRiotAuthToken($code, 'https://yourapp.com/callback');

        if ($accessToken) {
            $accountData = $riotGames->getRiotAccountData($accessToken);
            $accountData['puuid'] - Player UUID
            $accountData['gameName'] - In-game name
            $accountData['tagLine'] - Tag line
        }
    }
} catch (RiotGamesException $e) {
    echo "Error: " . $e->getMessage();
}
```

### Laravel Setup

[](#laravel-setup)

1. Publish the configuration file (optional):

```
php artisan vendor:publish --tag=riot-games-sso-config
```

2. Add your Riot Games credentials to your `.env` file:

```
RIOT_GAMES_CLIENT_ID=your_client_id
RIOT_GAMES_CLIENT_SECRET=your_client_secret
```

The service provider and facade are auto-discovered, so no manual registration is needed.

Usage
-----

[](#usage)

### Laravel Usage

[](#laravel-usage)

#### Using the Facade

[](#using-the-facade)

```
use Fuziion\RiotGamesSSO\Facades\RiotGames;

// Redirect user to Riot Games login
public function redirectToRiot()
{
    $callbackUrl = route('riot.callback');
    return redirect(RiotGames::getAuthorizationUrl($callbackUrl));
}

// Handle the callback
public function handleCallback(Request $request)
{
    try {
        $code = $request->get('code');
        $callbackUrl = route('riot.callback');

        // Exchange code for access token
        $accessToken = RiotGames::getRiotAuthToken($code, $callbackUrl);

        if ($accessToken) {
            // Get user account data
            $accountData = RiotGames::getRiotAccountData($accessToken);

            // $accountData contains:
            // - puuid: Player UUID
            // - gameName: In-game name
            // - tagLine: Tag line

            // Handle user authentication/login here
            // ...
        }
    } catch (\Fuziion\RiotGamesSSO\Exceptions\RiotGamesException $e) {
        // Handle error
        return redirect()->back()->with('error', $e->getMessage());
    }
}
```

#### Using Dependency Injection

[](#using-dependency-injection)

```
use Fuziion\RiotGamesSSO\RiotGames;

class RiotAuthController extends Controller
{
    public function __construct(
        protected RiotGames $riotGames
    ) {}

    public function redirectToRiot()
    {
        $callbackUrl = route('riot.callback');
        return redirect($this->riotGames->getAuthorizationUrl($callbackUrl));
    }

    public function handleCallback(Request $request)
    {
        $code = $request->get('code');
        $callbackUrl = route('riot.callback');

        $accessToken = $this->riotGames->getRiotAuthToken($code, $callbackUrl);
        $accountData = $this->riotGames->getRiotAccountData($accessToken);

        // Handle authentication...
    }
}
```

### Other PHP Frameworks (Symfony, CodeIgniter, etc.)

[](#other-php-frameworks-symfony-codeigniter-etc)

The package works the same way in any PHP framework. Just instantiate the class with your credentials:

```
use Fuziion\RiotGamesSSO\RiotGames;
use Fuziion\RiotGamesSSO\Exceptions\RiotGamesException;

// In your controller or service
$riotGames = new RiotGames(
    clientId: getenv('RIOT_GAMES_CLIENT_ID'),
    clientSecret: getenv('RIOT_GAMES_CLIENT_SECRET')
);

// Get authorization URL
$authUrl = $riotGames->getAuthorizationUrl('https://yourapp.com/callback');

// Exchange code for token
$accessToken = $riotGames->getRiotAuthToken($code, $redirectUri);

// Get account data
$accountData = $riotGames->getRiotAccountData($accessToken);
```

API Reference
-------------

[](#api-reference)

### Methods

[](#methods)

#### `getAuthorizationUrl(string $redirectUri, array $scopes = ['openid', 'offline_access', 'email']): string`

[](#getauthorizationurlstring-redirecturi-array-scopes--openid-offline_access-email-string)

Generate the authorization URL for redirecting users to Riot Games login.

**Parameters:**

- `$redirectUri` - The callback URL where Riot will redirect after authentication
- `$scopes` - Optional array of OAuth scopes (default: openid, offline\_access, email)

**Returns:** The full authorization URL

#### `getRiotAuthToken(string $code, string $redirectUri): string|null`

[](#getriotauthtokenstring-code-string-redirecturi-stringnull)

Exchange the authorization code for an access token.

**Parameters:**

- `$code` - The authorization code from the callback
- `$redirectUri` - The redirect URI used in the authorization request (must match exactly)

**Returns:** The access token or null if not found

**Throws:** `RiotGamesException` on error

#### `getRiotAccountData(string $accessToken): array`

[](#getriotaccountdatastring-accesstoken-array)

Get user account data using the access token.

**Parameters:**

- `$accessToken` - The OAuth access token

**Returns:** Array containing:

- `puuid` - Player UUID
- `gameName` - In-game name
- `tagLine` - Tag line

**Throws:** `RiotGamesException` on error

Example Routes (Laravel)
------------------------

[](#example-routes-laravel)

```
// routes/web.php
Route::get('/auth/riot', [RiotAuthController::class, 'redirectToRiot'])->name('riot.login');
Route::get('/auth/riot/callback', [RiotAuthController::class, 'handleCallback'])->name('riot.callback');
```

Error Handling
--------------

[](#error-handling)

The package throws `RiotGamesException` for all errors. Always wrap calls in try-catch blocks:

```
use Fuziion\RiotGamesSSO\Exceptions\RiotGamesException;

try {
    $accessToken = RiotGames::getRiotAuthToken($code, $redirectUri);
} catch (RiotGamesException $e) {
    // Handle error
    // $e->getMessage() contains the error message
    // $e->getCode() contains the HTTP status code (if applicable)
}
```

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- cURL extension enabled
- Riot Games Developer Account with OAuth credentials

Getting Riot Games Credentials
------------------------------

[](#getting-riot-games-credentials)

1. Visit the [Riot Games Developer Portal](https://developer.riotgames.com/)
2. Create a new application
3. Configure your redirect URI
4. Copy your Client ID and Client Secret

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

Author
------

[](#author)

**Diederik Veenstra** (fuziion\_dev)

- Website:
- GitHub: [@REFUZIION](https://github.com/REFUZIION)
- X: [@fuziion\_dev](https://x.com/fuziion_dev)

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

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

Support
-------

[](#support)

If you encounter any issues or have questions, please open an issue on [GitHub](https://github.com/REFUZIION/riot-games-sso/issues).

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance70

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

168d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6645057?v=4)[fuziion](/maintainers/fuziion)[@fuziion](https://github.com/fuziion)

---

Top Contributors

[![REFUZIION](https://avatars.githubusercontent.com/u/57800730?v=4)](https://github.com/REFUZIION "REFUZIION (3 commits)")

---

Tags

phplaravelAuthenticationSSOoauthriot-games

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fuziion-riot-games-sso/health.svg)

```
[![Health](https://phpackages.com/badges/fuziion-riot-games-sso/health.svg)](https://phpackages.com/packages/fuziion-riot-games-sso)
```

###  Alternatives

[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

123256.9k1](/packages/ellaisys-aws-cognito)[mi-lopez/laravel-sso

Simple PHP SSO integration for Laravel

621.1k](/packages/mi-lopez-laravel-sso)

PHPackages © 2026

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