kanalumaddela / laravel-steam-login
Steam Login/Auth package for Laravel/Lumen 5.5+ / 6.x+ / 7.x+ / 8.x+
Installs: 9 067
Dependents: 0
Suggesters: 1
Security: 0
Stars: 9
Watchers: 2
Forks: 10
Open Issues: 6
Requires
- php: ^7.3|^8.0
- ext-json: *
- ext-libxml: *
- ext-simplexml: *
- guzzlehttp/guzzle: ^6.5.5|^7.0.1
- xpaw/steamid: dev-master
Requires (Dev)
- orchestra/testbench: ^3.8
- phpunit/phpunit: ^8.1
- dev-master
- 2.x-dev
- 2.5.2
- 2.5.0
- 2.4.0
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.1
- 2.2.0
- 2.1.8
- 2.1.7
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1
- 2.0
- 1.x-dev
- 1.4.2
- 1.4.1
- 1.4
- 1.3.1
- 1.3.0
- 1.2.3
- 1.2.2
- 1.1.1
- 1.1.0
- 1.0.3
- 1.0.2
- 1.0.0
- dev-dependabot/composer/guzzlehttp/psr7-2.5.0
- dev-dependabot/composer/symfony/http-kernel-4.4.50
- dev-dependabot/composer/guzzlehttp/guzzle-7.4.5
This package is auto-updated.
Last update: 2024-09-19 23:35:34 UTC
README
Make sure you have made/performed the appropriate migrations. I suggest doing whatever works best for you, but certain suggestions should be followed to avoid trouble.
Features
- Laravel/Lumen supported
- Optionally redirect users to the previous page before logging in
- Included abstract controller and routes for easy setup
SteamUser
class to easily retrieve a player's data
[3.x / 2.x] Quick Setup
- Install library
composer require kanalumaddela/laravel-steam-login
- Publish files
php artisan vendor:publish --force --provider kanalumaddela\LaravelSteamLogin\SteamLoginServiceProvider
- Create Controller
php artisan make:controller Auth\SteamLoginController
- Add routes
routes/web.php
use App\Http\Controllers\Auth\SteamLoginController; use kanalumaddela\LaravelSteamLogin\Facades\SteamLogin; //... // If using steam login only, add ['include_login_route' => true] // to also add a /login route, SteamLogin::routes([ 'controller' => SteamLoginController::class, ]);
- Edit Controller
App\Http\Controllers\Auth\SteamLoginController.php
<?php namespace App\Http\Controllers\Auth; use Illuminate\Http\Request; use kanalumaddela\LaravelSteamLogin\Http\Controllers\AbstractSteamLoginController; use kanalumaddela\LaravelSteamLogin\SteamUser; class SteamLoginController extends AbstractSteamLoginController { /** * {@inheritdoc} */ public function authenticated(Request $request, SteamUser $steamUser) { // auth logic goes here, below assumes User model with `steam_account_id` attribute // $user = User::where('steam_account_id', $steamUser->accountId)->first(); // \Illuminate\Support\Facades\Auth::login($user); } }
Credits
Thanks to these libs which led me to make this
- https://github.com/Ehesp/Steam-Login (Parts of code used and re-purposed for laravel)
- https://github.com/invisnik/laravel-steam-auth (Getting me to create a laravel steam auth/login that isn't bad)