2017 © Pedro Peláez
 

library laravel-wargaming-auth

Laravel Wargaming Auth

image

azate/laravel-wargaming-auth

Laravel Wargaming Auth

  • Monday, March 5, 2018
  • by arikaiy
  • Repository
  • 0 Watchers
  • 3 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 300 % Grown

The README.md

Wargaming authentication for Laravel 5

License Latest Stable Version Total Downloads, (*1)

This package is a Laravel 5 service provider which provides support for Wargaming OpenID and is very easy to integrate with any project that requires Wargaming authentication., (*2)

Installation

Require this package with composer., (*3)

composer require azate/laravel-wargaming-auth

Laravel >=5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider., (*4)

Copy the package config to your local config with the publish command:, (*5)

php artisan vendor:publish --provider="Azate\Laravel\WargamingAuth\Providers\WargamingAuthServiceProvider"

Usage example

In routes/web.php:, (*6)

Route::get('auth/wargaming/{wargamingAuthRegion?}', 'AuthController@redirectToWargaming')->name('auth.wargaming');
Route::get('auth/wargaming/callback', 'AuthController@handleWargamingCallback')->name('auth.wargaming.handle');

In AuthController:, (*7)

namespace App\Http\Controllers;

use Azate\Laravel\WargamingAuth\WargamingAuth;
use Illuminate\Http\RedirectResponse;

class AuthController extends Controller
{
    /**
     * @var WargamingAuth
     */
    protected $wargamingAuth;

    /**
     * AuthController constructor.
     *
     * @param WargamingAuth $wargamingAuth
     */
    public function __construct(WargamingAuth $wargamingAuth)
    {
        $this->wargamingAuth = $wargamingAuth;
    }

    /**
     * Redirect the user to the authentication page.
     *
     * @param string|null $region
     *
     * @return RedirectResponse
     */
    public function redirectToWargaming(string $region = null): RedirectResponse
    {
        if ($region) {
            $this->wargamingAuth->setRegion($region);
        }

        return new RedirectResponse($this->wargamingAuth->redirectUrl());
    }

    /**
     * Get user info and log in (hypothetically).
     *
     * @return RedirectResponse
     */
    public function handleWargamingCallback(): RedirectResponse
    {
        if ($this->wargamingAuth->verify()) {
            $user = $this->wargamingAuth->user();

            //

            return new RedirectResponse('/');
        }

        return $this->redirectToWargaming();
    }
}

The Versions

05/03 2018

dev-master

9999999-dev

Laravel Wargaming Auth

  Sources   Download

MIT

The Requires

 

by Artem Didyk

laravel auth wargaming

05/03 2018

v1.0.1

1.0.1.0

Laravel Wargaming Auth

  Sources   Download

MIT

The Requires

 

by Artem Didyk

laravel auth wargaming

04/03 2018

v1.0.0

1.0.0.0

Laravel Wargaming Auth

  Sources   Download

MIT

The Requires

 

by Artem Didyk

laravel auth wargaming