developing-with-turbo-basics
Turbo Laravel Basics
Turbo Laravel is a package that integrates Turbo, a set of technologies for building modern web applications, with the Laravel framework. Turbo enhances user experience by enabling partial page updates, real-time interactions, and seamless navigation without full page reloads and with minimal JavaScript.
Philosophy: HTML Over the Wire
Hotwire (HTML Over the Wire) sends HTML instead of JSON from the server, letting the server handle rendering while keeping the browser's job simple. It combines four techniques:
- Turbo Drive — Accelerates links and forms by replacing the
<body>without full page loads. - Turbo Frames — Decomposes pages into independent segments that scope navigation and can lazy-load.
- Turbo Streams — Delivers partial page changes over WebSocket, SSE, or in response to form submissions using eight actions (append, prepend, replace, update, remove, before, after, refresh).
- Stimulus — A modest JavaScript framework for the HTML you already have, connecting behavior via
data-controller,data-action, anddata-targetattributes.
Turbo Laravel provides the server-side tooling (Blade components, helpers, broadcasting, and testing utilities) to make these techniques work seamlessly with Laravel.
Turbo Drive
Turbo Drive intercepts all clicks on <a href> links to the same domain and all form submissions, turning them into fetch requests. It replaces the <body> and merges the <head>, keeping the JavaScript window and document objects persistent across navigations. This gives SPA-like speed without client-side routing.