1. Go to this page and download the library: Download rareform/craft-inertia library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
return [
/**
* The root template that will be rendered when first loading your Inertia app
* (https://inertiajs.com/the-protocol#html-responses).
* Includes the div the inertia app will be rendered to:
* `<div id="app" data-page="{{ page|json_encode }}"></div>`
* and calls the Inertia app `<script src="<path_to_app>/app.js"></script>`
*/
'view' => 'base.twig',
/**
* Whether inertia's assets versioning shall be used
* (https://inertiajs.com/the-protocol#asset-versioning)
*/
'useVersioning' => true,
/**
* Array of directories that will be checked for changed assets if `useVersioning` => true
*/
'assetsDirs' => [
'@webroot/dist/assets'
],
/**
* Whether to inject the route matched element (`entry` or `category`) automatically into the application
*/
'injectElementAsProp' => false,
/**
* Whether to takeover all routing and forward to Inertia
* If set to false, you can use Inertia in parallel to normal twig templates
* Route rules will need to be set in config/routes.php, eg:
* '' => 'inertia/base/index',
* '<catchall:.+>' => 'inertia/base/index',
*/
'takeoverRouting' => true,
/**
* Whether to enable automatic capturing of variables set with `{% set %}` in your twig files
* and have them passed as props to your Inertia components.
*/
'autoCaptureVariables' => false,
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.