laravel/breeze
Laravel Breeze is a minimal, simple authentication starter kit for Laravel 11.x and earlier. It provides login, registration, password reset, email verification, and basic scaffolding to kickstart new apps.
Installation (Updated for Laravel 13+ compatibility):
composer require laravel/breeze --dev
php artisan breeze:install [stack] # Choose: blade, react, vue, or api
npm install && npm run dev
php artisan migrate
bootstrap.js is no longer auto-imported (fixed in v2.4.2). Ensure your resources/js/app.js manually includes:
import './bootstrap'; // Explicit import for Laravel 13+
First Use Case:
/login, /register, /dashboard).resources/views/auth/ (Blade) or resources/js/Pages/ (React/Vue).resources/js/bootstrap.js exists (create if missing) with:
import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/vue3';
// ... rest of config
Key Files to Inspect:
app/Http/Controllers/Auth/ (Logic unchanged).routes/web.php (Middleware groups may need adjustment for Laravel 13+).resources/js/bootstrap.js (Critical for Laravel 13+ stacks).bootstrap.js is imported in app.js:
// resources/js/app.js
import './bootstrap'; // Required for Laravel 13+
import { createApp, h } from 'vue';
SanctumServiceProvider is registered in config/app.php:
'providers' => [
Laravel\Sanctum\SanctumServiceProvider::class,
],
auth middleware from Illuminate\Auth\Middleware\Authenticate:
Route::middleware(['auth', 'verified'])->group(function () {
Route::get('/dashboard', DashboardController::class);
});
auth:sanctum works as before, but verify config/sanctum.php includes:
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', 'localhost,127.0.0.1:3000')),
app/Http/Controllers/Auth/RegisteredUserController.php):
public function register(Request $request) {
$validated = $request->validate([
'name' => 'required|string|max:255',
'email' => 'required|email|unique:users',
'password' => ['required', 'confirmed', 'min:8'],
]);
return User::create($validated);
}
Illuminate\Validation\Rules\Password for stricter defaults:
'password' => ['required', 'confirmed', Rules\Password::defaults()],
$user->sendEmailVerificationNotification();
VerifyEmail notification (unchanged):
public function toMail($notifiable) {
return (new MailMessage)
->line('Verify your email')
->action('Verify', url('/verify-email').'?token='.$notifiable->createVerificationToken());
}
broker() in ResetPasswordController:
protected function broker() {
return Password::broker('ui')->tokensExpireAfter(CarbonInterval::hours(24));
}
@auth
<p>Welcome, {{ auth()->user()->name }}!</p>
@endauth
session() helper is available via Illuminate\Session\Middleware\StartSession.return Inertia::render('Dashboard', ['stats' => $this->getStats()]);
inertia.js is loaded in resources/js/app.js:
import { createInertiaApp } from '@inertiajs/vue3';
$token = $user->createToken('api-token')->plainTextToken;
config/sanctum.php includes:
'expiring_token_lifetime' => CarbonInterval::hours(1),
spatie/laravel-typescript-transformer (unchanged):
#[AsTypeScriptType]
class User extends Authenticatable { ... }
resources/js/shims-vue.d.ts targets Vue 3:
declare module '@inertiajs/core' {
interface PageProps {
auth: { user: User };
}
}
AuthenticationTests (unchanged):
use Laravel\Breeze\Tests\AuthenticationTests;
class CustomAuthTests extends AuthenticationTests {
protected function getRegistrationData() {
return [
'name' => 'Test',
'email' => 'test@example.com',
'password' => 'password',
'password_confirmation' => 'password',
];
}
}
config/cors.php (unchanged):
'paths' => ['api/*', 'sanctum/csrf-cookie'],
'allowed_methods' => ['*'],
'allowed_origins' => ['https://your-app.com'],
bootstrap.js is built and served:
npm run build
Missing bootstrap.js in Laravel 13+
bootstrap is not defined.resources/js/bootstrap.js if missing:
import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/vue3';
createInertiaApp({
resolve: name => require(`./Pages/${name}.vue`),
setup({ el, App, props, plugin }) {
createApp({ render: () => h(App, props) })
.use(plugin)
.mount(el);
},
});
Middleware Group Conflicts (Laravel 13+)
auth middleware may not work if web middleware is misconfigured.app/Http/Kernel.php, ensure:
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Auth\Middleware\Authenticate::class, // Must come after EncryptCookies
],
Sanctum CSRF Token Missing
419 Unknown status group in API requests.config/sanctum.php:
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', 'localhost,127.0.0.1:3000,your-app.test')),
Vue/React TypeScript Errors
Property 'auth' does not exist on type 'PageProps'.resources/js/shims-vue.d.ts:
declare module '@inertiajs/core' {
interface PageProps {
auth: { user: User | null };
}
}
Tailwind Dark Mode Persistence
localStorage in app.js:
How can I help you explore Laravel packages today?