mortezamasumi/fb-auth

Filament authentication with mobile, code, username, and magic-link flows

Maintainers

Package info

github.com/mortezamasumi/fb-auth

pkg:composer/mortezamasumi/fb-auth

Transparency log

Statistics

Installs: 232

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v5.1.0 2026-07-31 10:33 UTC

README

Latest Version on Packagist GitHub Tests Action Status Total Downloads License

A Filament v5 plugin that provides configurable authentication flows for your Laravel admin panel: magic link, email code, mobile SMS code, and username/password. It ships custom login, registration, email verification, and password-reset pages — with rate-limited, OTP-based resend actions and bilingual notifications.

Features

  • Four auth flows — switch with a single config key: link (magic link), code (email code), mobile (SMS code via fb-sms), and user (username/password)
  • OTP login & registration — dedicated pages with a resendable, expiring code for code and mobile flows
  • Code-based password reset — request, resend, and reset flows built on the same OTP mechanism
  • Email verification prompt — code input page for verifying newly registered users
  • SMS delivery — mobile codes are sent through the configured fb-sms gateway
  • Rate limiting — every send/verify action is throttled to prevent abuse
  • Localized UI — Persian and English translations shipped out of the box

Installation

composer require mortezamasumi/fb-auth

Publish the config file:

php artisan vendor:publish --tag="fb-auth-config"

Optionally publish the views:

php artisan vendor:publish --tag="fb-auth-views"

Configuration

// config/fb-auth.php
return [
    'auth_type' => env('AUTH_TYPE', 'link'),
    'otp_digits' => env('OTP_DIGITS', 4),
    'otp_expiration' => env('OTP_EXPIRATION', 120),
];
  • auth_typelink (default), code, mobile, or user
  • otp_digits — length of the generated verification code (default 4)
  • otp_expiration — code lifetime in seconds (default 120)

Usage

Register the plugin in a panel

use Mortezamasumi\FbAuth\FbAuthPlugin;

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

Choose an auth flow

Set AUTH_TYPE in your .env:

Value Flow Login / register Reset password
link Magic link Filament's built-in pages Filament's built-in pages
code Email code OTP page (code sent by email) OTP-based reset pages
mobile Mobile SMS code OTP page (code sent by SMS) OTP-based reset pages
user Username / password Filament's built-in pages disabled

Generate and send codes

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('test@example.com'); // masked email, e.g. **st@**mp.**m

Support policy

PHP Laravel Filament
8.3 12 5.x

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

Security

If you discover a security vulnerability, please review our security policy on how to report it.

Changelog

Please see CHANGELOG for recent changes.

License

The MIT License (MIT). See LICENSE.md for details.