Download the PHP package framgia/fauth-php without Composer
On this page you can find all versions of the php package framgia/fauth-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download framgia/fauth-php
More information about framgia/fauth-php
Files in framgia/fauth-php
Informations about the package fauth-php
FAuth (Framgia Authentication)
Installation
To get started with FramgiaAuth, use Composer to add the package to your project's dependencies:
composer require framgia/fauth-php
Run the following command:
composer update
Configuration
After installing the Fauth library, register the Framgia\Fauth\FAuthServiceProvider in your config/app.php configuration file:
Framgia\Fauth\FAuthServiceProvider::class,
Also, add the Fauth facade to the aliases array in your app configuration file:
'Fauth' => Framgia\Fauth\Facades\Fauth::class,
You will also need to add credentials for the OAuth services your application utilizes. These credentials should be placed in your config/services.php configuration file, and should use the key framgia for the framgia provider. For example:
Add the following to your composer.json (autoload-dev -> psr-4)
"Framgia\\Fauth\\": "vendor/framgia/fauth/"
Run below command:
composer dump-autoload
Basic Usage
Next, you are ready to authenticate users! You will need two routes: one for redirecting the user to the OAuth provider, and another for receiving the callback from the provider after authentication. We will access Fauth using the Fauth facade:
Of course, you will need to define routes to your controller methods:
Once you have a user instance, you can grab a few more details about the user:
If you already have a valid access token for a user, you can retrieve their details using the userFromToken method:
$user = Fauth::driver('framgia')->userFromToken($token);