Skip to content

Installation

Turbo Laravel may be installed via Composer:

composer require hotwired/turbo-laravel

After installing, you may execute the turbo:install Artisan command, which will add a couple JS dependencies to your package.json file (when you're using Vite and NPM) or to your routes/importmap.php file (when you're using Importmap Laravel), publish some JS scripts to your resources/js folder that configure Turbo.js for you:

php artisan turbo:install

If you are using Jetstream with Livewire, you may add the --jet flag to the turbo:install Artisan command, which will add a couple more JS dependencies to make sure Alpine.js works nicely with Turbo.js. This will also change the layout that ships with Jetstream files a bit, which will make sure Livewire works nicely as well:

php artisan turbo:install --jet

When using Jetstream with Livewire, the Livewire Turbo Plugin is needed so Livewire works nicely with Turbo. This one will be added to your Jetstream layouts as script tags fetching from a CDN (both app.blade.php and guest.blade.php).

If you're not using Importmap Laravel, the install command will tell you to pull and compile the assets before proceeding:

npm install && npm run build

You may also optionally install Alpine.js in a non-Jetstream context (maybe you're more into Breeze) passing --alpine flag to the turbo:install Artisan command:

php artisan turbo:install --alpine

Note: the --jet option also adds all the necessary Alpine dependencies since Jetstream depends on Alpine.

Continue to Overview...