Laravel Fortify is a backend authentication framework for Laravel applications that handles common user authentication tasks such as login, registration, password reset, and email verification. It does not include front-end scaffolding, making it suitable for SPA or custom UI integrations.
Fortify was introduced to provide a backend-only authentication solution for developers who want to build custom front-end interfaces for their applications.
Install Fortify:
composer require laravel/fortify
php artisan vendor:publish --provider="Laravel\Fortify\FortifyServiceProvider"
Enable Fortify in config/app.php
:
'providers' => [
Laravel\Fortify\FortifyServiceProvider::class,
];
Customize authentication logic in FortifyServiceProvider
:
Fortify::authenticateUsing(function (Request $request) {
$user = User::where('email', $request->email)->first();
if ($user && Hash::check($request->password, $user->password)) {
return $user;
}
});
Fortify provides a robust backend for authentication, giving developers full control over the front-end experience.