Laravel Starter Kits
Laravel’s starter kits provide out-of-the-box scaffolding for new Inertia applications.These starter kits are the absolute fastest way to start building a new Inertia project using Laravel and Vue or React. However, if you would like to manually install Inertia into your application, please consult the documentation below.
Installation
1
Install dependencies
First, install the Inertia client-side adapter corresponding to your framework of choice.
2
Initialize the Inertia app
Next, update your main JavaScript file to boot your Inertia app. To accomplish this, we’ll initialize the client-side framework with the base Inertia component.The
setup callback receives everything necessary to initialize the client-side framework, including the root Inertia App component.Configuring Defaults
You may pass adefaults object to createInertiaApp() to configure default settings for various features. You don’t have to pass a default for every key, just the ones you want to tweak.
visitOptions callback receives the target URL and the current visit options, and should return an object with any options you want to override. For more details on the available configuration options, see the forms, prefetching, and manual visits documentation.
Updating Configuration at Runtime
You may also update configuration values at runtime using the exportedconfig instance. This is particularly useful when you need to adjust settings based on user preferences or application state.
Resolving Components
Theresolve callback tells Inertia how to load a page component. It receives a page name (string), and returns a page component module. How you implement this callback depends on which bundler (Vite or Webpack) you’re using.
Defining a Root Element
By default, Inertia assumes that your application’s root template has a root element with anid of app. If your application’s root element has a different id, you can provide it using the id property.
id of the root element, be sure to update it server-side as well.