inertiajs/inertia-laravel
The official Laravel adapter for Inertia.js. Build modern single-page apps using classic server-side routing and controllers—no API boilerplate. It serves JSON page props to Vue, React, or Svelte frontends while Laravel handles routing, middleware, and validation.
Architecture fit
inertiajs/inertia-laravel is the server-side half of Inertia.js: controllers return Inertia::render('Page', $props) and the adapter serializes props into a JSON page object, resolves the correct root Blade view, and negotiates responses based on the X-Inertia header. This is an architectural commitment, not a utility dependency — it defines how every controller returns data and how the frontend is bootstrapped.once() props, scroll props, flash data, history encryption). The project is narrow in scope by design and has stayed narrow for years — a good sign for long-term maintainability.Integration feasibility
composer require inertiajs/inertia-laravel, publish config, register HandleInertiaRequests middleware, one root Blade template with @inertia/@inertiaHead, plus the matching JS client adapter and a Vite build. A competent Laravel pair can ship a first page in a day.only/except, dot notation), defer/optional/merge/once/always prop semantics, validation-error sharing, Route::inertia(), SSR commands (inertia:start-ssr/stop-ssr), and Laravel-native test helpers (AssertableInertia, flash assertions).inertia-laravel (PHP) ↔ @inertiajs/vue3|react|svelte (JS client) ↔ your framework major. These must move together. v1→v2 renamed Inertia::lazy() to optional() and changed prop metadata semantics; mismatched pairs fail subtly (props ignored, metadata misread) rather than loudly.Technical risk
once/defer hide N+1s until a partial reload or deferred request evaluates them in production. This needs a written prop discipline (API Resources, explicit arrays) enforced in review.Key questions
Stack fit
@inertiajs/* adapter. If the app is on an older Laravel LTS, the v2 line is unavailable — that constraint must be resolved before the Inertia decision, not after.Migration path
HandleInertiaRequests only alters responses for Inertia requests, so coexistence is safe but should still be verified with a smoke test on legacy pages.HandleInertiaRequests::share() (auth user, flash, app config), a prop convention (API Resources), a layout system, a form/error-handling pattern, and a frontend directory structure. Pages migrated before these exist get rewritten.Compatibility
package.json or a compatibility note in the README) so upgrades can't drift.AssertableInertia / Inertia::assert, Pest or PHPUnit as appropriate, and a separate frontend test layer (Vitest/Playwright). Teams routinely underbudget this — the backend tests will now assert page + props, not HTML.X-Forwarded-For and Vary header fixes historically); verify the Vary: X-Inertia header survives the CDN config, or caching will serve the wrong representation.Sequencing
defer/optional, once() props, prefetching. Only after payloads are measured; these are optimizations, not architecture.Maintenance
Support
composer.lock/lockfile, keeping an internal owner of the Inertia integration (not of the upstream package), and documenting a fallback position: worst case, the adapter is small enough to vendor or fork, and any single page can be reverted to a Blade route.Scaling
defer/optional, merge (infinite scroll / pagination), and once() props are the levers that keep payloads flat as pages grow. Using them well is a genuine performance advantage over a naive SPA fetching several endpoints; using them badly is worse than Blade.Vary: X-Inertia header must be preserved by the CDN, and Inertia responses are per-session in practice. Don't plan to cache page responses at the edge.Failure modes
defer/optional/once props are evaluated on later requests, so slow queries and exposed columns can surface only under real navigation patterns. Requires prop-level review discipline and query monitoring on partial-reload endpoints.Ramp-up
How can I help you explore Laravel packages today?