Installation
Turbo Laravel can be installed via Composer:
composer require hotwired-laravel/turbo-laravel:^2.0.0-beta1
After installing the package, you may run the turbo:install
Artisan command. This command will add the Turbo.js dependency to your package.json
file (when you're using Vite and NPM) or to your routes/importmap.php
file (when it detects that you're using Importmap Laravel). It also publishes some files to your resources/js
folder, which imports Turbo for you:
php artisan turbo:install
If you're using Laravel Jetstream with Livewire, you may add the --jet
flag to the turbo:install
Artisan command. This flag will add some required JS dependencies to make sure Alpine.js works well with Turbo. It also changes the layout files that ships with Jetstream adding the Livewire Turbo Plugin to make sure Livewire works well with Turbo, too:
php artisan turbo:install --jet
If you're using Alpine.js in a non-Jetstream context (maybe you're more into Breeze), you may use the --alpine
flag in the turbo:install
Artisan command:
php artisan turbo:install --alpine