PHP code example of rainwaves / lara-auth-suite

1. Go to this page and download the library: Download rainwaves/lara-auth-suite 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/ */

    

rainwaves / lara-auth-suite example snippets


use Rainwaves\LaraAuthSuite\Support\Enums\AuthMode;
use Rainwaves\LaraAuthSuite\Support\Enums\AuthFeature;
use Rainwaves\LaraAuthSuite\Support\Enums\TwoFactorChannel;

return [
    'route_prefix' => 'auth',
    'mode'         => AuthMode::Session->value, // session | token | both
    'user_model'   => null,
    'user_resource' => null,
    'debug_ping'   => false, // enable GET /auth/ping (disable in production)

    'frontend' => [
        'password_reset_url' => env('AUTHX_FRONTEND_RESET_URL', '/auth/reset-password'),
    ],

    'password_reset' => [
        'revoke_tokens' => true,       // revoke all Sanctum PATs on reset
        'invalidate_sessions' => true, // remove other database-backed sessions on reset
        'notify_user' => true,         // best-effort "your password was changed" notification
    ],

    // Devices is intentionally absent — trusted-device management is v2.2
    // scope and isn't implemented yet. Add AuthFeature::Devices->value here
    // only once that ships.
    'features' => [
        AuthFeature::PasswordReset->value,
        AuthFeature::TwoFactor->value,
        AuthFeature::Tokens->value,
    ],

    '2fa' => [
        'channels'    => [TwoFactorChannel::Email->value, TwoFactorChannel::Totp->value],
        'enforcement' => 'optional', // off | optional | ither half to 0 to
    // disable just that dimension.
    'throttle' => [
        'login_per_account' => 5,
        'login_per_ip' => 20,
        'password_reset_per_account' => 3,
        'password_reset_per_ip' => 10,
        'otp_send_per_account' => 3,
        'otp_send_per_ip' => 10,
        'two_factor_per_account' => 5,
        'two_factor_per_ip' => 20,
        'decay_seconds' => 60,
    ],

    'registration' => [
        'enabled'               => false,  // opt-in — disabled by default
        'issue_token_on_register' => false, // opt-in
        'default_roles'         => [],
        'default_permissions'   => [],
        'allow_self_assign_roles' => false,
        'allow_self_assign_permissions' => false,
        'rules' => [
            'name'       => ['
bash
php artisan vendor:publish \
  --provider="Rainwaves\\LaraAuthSuite\\LaraAuthSuiteServiceProvider" \
  --tag=authx-config
bash
php artisan migrate

POST /auth/session/2fa/recovery
POST /auth/2fa/recovery