Search by

datalogix / laravel-guardian

ricardogobbosouza

Extensible Laravel authentication package providing actions for login, logout, sign-up, password reset, email verification and related security features.

Package info

github.com/datalogix/laravel-guardian

pkg:composer/datalogix/laravel-guardian

Fund package maintenance!

ricardogobbosouza

Open Collective

Statistics

Installs: 280

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-09-14 18:02 UTC

This package is auto-updated.

Last update: 2026-09-14 18:02:21 UTC


README

Latest Stable Version Total Downloads tests StyleCI codecov License

Laravel Guardian is an extensible authentication package providing login, sign-up, password reset, email verification, two-factor authentication and OAuth social login — all built on top of Livewire.

Installation

You can install the package via composer:

composer require datalogix/laravel-guardian

The package will automatically register itself.

Quick start

Register at least one "fortress" — a self-contained authentication flow bound to a guard and, optionally, a domain or path prefix — from a service provider's boot method:

use Datalogix\Guardian\Fortress;
use Datalogix\Guardian\Guardian;

public function boot(): void
{
    Guardian::registerFortress(Fortress::make()->basic());
}

Then run the migrations. Guardian only loads the migrations it actually needs, based on which features you enabled (two-factor columns, trusted devices, OAuth identities):

php artisan migrate

You can register more than one fortress to run independent auth flows side by side — for example a customer-facing app and an admin panel:

Guardian::registerFortress(Fortress::make()->basic());
Guardian::registerFortress(Fortress::make()->admin());

Features

  • 🔑 Login & Logout – Session-based authentication with rate limiting and remember-me support.
  • 📝 Sign-up – Self-service registration with configurable identifier (email, username, CPF or CNPJ).
  • 🔁 Password Reset & Confirmation – Forgot-password flow and password re-confirmation for sensitive actions.
  • ✉️ Email Verification – Signed, expiring verification links.
  • 🔒 Two-Factor Authentication – TOTP (authenticator app), email or SMS codes, recovery codes and trusted devices.
  • 🌐 OAuth / Social Login – Sign in with any Laravel Socialite provider, with automatic account linking.
  • 🏰 Multiple Fortresses – Run independent authentication flows per guard, domain or path (e.g. customer app + admin panel).
  • 🚦 Rate Limiting – Configurable throttling on every sensitive action out of the box.
  • 🇧🇷 CPF/CNPJ Validation – Ready-to-use validation rules for Brazilian documents.

Configuration

All features are optional and configurable per fortress through the fluent Fortress API (see src/Concerns for the full list of available methods, e.g. twoFactor(), oauth(), signUp(), emailVerification()).

You can publish the package config, views and translations with:

php artisan vendor:publish --provider="Datalogix\Guardian\GuardianServiceProvider" --tag="guardian-config"
php artisan vendor:publish --provider="Datalogix\Guardian\GuardianServiceProvider" --tag="guardian-views"
php artisan vendor:publish --provider="Datalogix\Guardian\GuardianServiceProvider" --tag="guardian-lang"

Publishing the config creates a config/guardian.php file:

// config/guardian.php

return [
    'framework' => Framework::tryFrom(env('GUARDIAN_FRAMEWORK')) ?? Framework::Livewire,
    'cache_path' => base_path('bootstrap/cache/guardian'),
];

Note: only the Livewire front-end is currently supported. Inertia is present in the API for a future release but is not implemented yet — a fortress configured to use it will fail fast on boot with a clear error.