PHP code example of mortezamasumi / fb-auth

1. Go to this page and download the library: Download mortezamasumi/fb-auth library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mortezamasumi / fb-auth example snippets


// config/fb-auth.php
return [
    'auth_type' => env('AUTH_TYPE', 'link'),
    'otp_digits' => env('OTP_DIGITS', 4),
    'otp_expiration' => env('OTP_EXPIRATION', 120),
];

use Mortezamasumi\FbAuth\FbAuthPlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugin(FbAuthPlugin::make());
}

use Mortezamasumi\FbAuth\Facades\FbAuth;

$code = FbAuth::createCode($user);        // generates + caches a code for the user
$digits = FbAuth::generateRandomCode();   // random code using otp_digits/otp_expiration

echo FbAuth::encodeEmail('[email protected]'); // masked email, e.g. **st@**mp.**m

public function panel(Panel $panel): Panel
{
    return $panel
        ->login()
        ->registration()
        ->passwordReset()
        ->emailVerification()   // 

$panel
    ->emailVerification(MyVerificationPrompt::class)   // extend Mortezamasumi\FbAuth\Pages\VerificationPrompt
    ->passwordReset(MyRequestPasswordReset::class, MyResetPassword::class);
bash
php artisan vendor:publish --tag="fb-auth-config"
bash
php artisan vendor:publish --tag="fb-auth-views"