Installation Run:
composer require codesren/breezify
php artisan breeze:install breezify
npm install && npm run dev
This installs Breeze with Fortify as the backend, skipping the default Breeze stack.
First Use Case
/login, /register) immediately.app/Providers/FortifyServiceProvider.php to confirm Fortify’s session handling and authentication logic.resources/views/auth/ for pre-built UI components (e.g., login.blade.php, register.blade.php).Customizing Authentication Logic
app/Providers/FortifyServiceProvider.php:
public function boot()
{
Fortify::authenticateUsing(function (Request $request) {
return CustomAuth::attempt($request->only('email', 'password'));
});
}
resources/views/auth/ to your project and modifying them.Adding Multi-Factor Authentication (MFA)
Fortify::enableTwoFactorAuthentication();
resources/views/auth/two-factor-challenge.blade.php.API Authentication
use Laravel\Fortify\Actions\CreateNewUser;
use Laravel\Fortify\Actions\AttemptToAuthenticate;
Sanctum or Passport alongside Fortify for API routes.Session Management
.env (e.g., SESSION_DRIVER=database).app/Providers/FortifyServiceProvider.php:
Fortify::withSessionConfiguration(function ($session) {
$session->timeout(1440); // 24 minutes
});
Validation Rules
php artisan vendor:publish --provider="Laravel\Fortify\FortifyServiceProvider"
config/fortify.php or create custom rules in app/Rules/.npm run dev or npm run build to compile assets. Customize webpack.mix.js for additional JS/CSS.users, failed_jobs, and sessions tables. Review database/migrations/ for customizations.use Laravel\Fortify\Features;
Features::testsUsing()->createApplication();
resources/lang/.Fortify vs. Breeze Conflicts
AuthController with Fortify’s LoginController.app/Http/Controllers/AuthenticatedSessionController.php) for auth logic.CSRF Token Issues
app/Http/Kernel.php:
'web' => [
\App\Http\Middleware\VerifyCsrfToken::class,
],
Session Driver Mismatches
SESSION_DRIVER=database, ensure the sessions table exists and is properly configured.storage/logs/laravel.log for session-related errors.Email Verification Quirks
config/fortify.php:
'features' => [
Features::registration(),
Features::emailVerification(),
],
Mail::fake() in tests.Route Caching
php artisan route:clear
Fortify::authenticated(function (User $user) {
Log::info('User authenticated', ['user' => $user->id]);
});
public function handle($request, Closure $next)
{
Log::debug('Auth attempt', ['input' => $request->only('email', 'password')]);
return $next($request);
}
php artisan vendor:publish --tag="fortify-config"
Custom User Models
User model by publishing Fortify’s migrations:
php artisan vendor:publish --provider="Laravel\Fortify\FortifyServiceProvider" --tag="migrations"
users table and update app/Models/User.php.Socialite Integration
app/Providers/FortifyServiceProvider.php:
Fortify::authenticateWithGitHub();
config/services.php.Password Reset Customization
resources/views/auth/reset-password.blade.php).app/Actions/Fortify/PasswordReset.php.Rate Limiting
app/Providers/FortifyServiceProvider.php:
Fortify::limitAttemptsByIp();
Fortify::limitAttemptsPerMinute(5);
Testing Fortify
$response = $this->post('/login', ['email' => 'user@example.com', 'password' => 'password']);
$response->assertRedirect('/dashboard');
How can I help you explore Laravel packages today?