Using Laravel 13 with Breeze

Laravel Breeze runs smoothly with Laravel 11.x and prior. But what if you want to use it for Laravel 13.x ? Here is a breakdown of the steps to follow.

First, let’s create a new Laravel project:

1
composer create-project laravel/laravel laravel13breeze
1
2
3
cd laravel13breeze
php artisan -V
Laravel Framework 13.24.0

Next, let’s add Laravel Breeze:

1
composer require laravel/breeze --dev

Then create resources/js/bootstrap.js with the following content:

1
2
3
4
import axios from 'axios';
window.axios = axios;

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

We need to add this file because installing Laravel Breeze will instruct resources/js/app.js to load resources/js/bootstrap.js which does not exist and which fail to create like it was able to do with Laravel 11.x and prior.

Now you’re ready to install Laravel Breeze by explicitly passing your favorite frontend stack along with a flag telling it to run entirely headless and automatically, disabling all interactive prompts, confirmation boxes, and choice menus:

1
php artisan breeze:install vue --no-interaction

At this stage, the Breeze scaffolding files are published into your application directory, all you have to do is:

1
2
3
composer update
npm install
composer run dev

Check your routes/web.php file and update it upon your needs:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

use App\Http\Controllers\ProfileController;
use Illuminate\Foundation\Application;
use Illuminate\Support\Facades\Route;
use Inertia\Inertia;

Route::get('/', function () {
    return Inertia::render('Welcome', [
        'canLogin' => Route::has('login'),
        'canRegister' => Route::has('register'),
        'laravelVersion' => Application::VERSION,
        'phpVersion' => PHP_VERSION,
    ]);
});

Route::get('/dashboard', function () {
    return Inertia::render('Dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');

Route::middleware('auth')->group(function () {
    Route::get('/profile', [ProfileController::class, 'edit'])->name('profile.edit');
    Route::patch('/profile', [ProfileController::class, 'update'])->name('profile.update');
    Route::delete('/profile', [ProfileController::class, 'destroy'])->name('profile.destroy');
});

require __DIR__.'/auth.php';

That’s it.