Enhanced Symfony adapter for Inertia.js.
MIT License
This is an enhanced Inertia.js server-side adapter based on rompetomp/inertia-bundle.
The inspiration and some of the API/code for this Bundle comes from the Laravel Inertia Adapter.
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Open a command console, enter your project directory and execute:
$ composer require mercuryseries/inertia-bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require mercuryseries/inertia-bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php
file of your project:
// config/bundles.php
return [
// ...
MercurySeries\Bundle\InertiaBundle\MercurySeriesInertiaBundle::class => ['all' => true],
];
Add --ssr
to any of the following options to add Server-side Rendering (SSR) support:
# React + Webpack Encore
$ symfony console inertia:install react --bundler=webpack
# React + Vite
$ symfony console inertia:install react --bundler=vite
# Vue + Webpack Encore
$ symfony console inertia:install vue --bundler=webpack
# Vue + Vite
$ symfony console inertia:install vue --bundler=vite
Add the following route configuration if it's missing:
# config/routes.yaml
controllers:
resource:
path: ../src/Controller/
namespace: App\Controller
type: attribute
+ defaults:
+ csrf:
+ create: true
+ require:
+ - 'POST'
+ - 'PUT'
+ - 'PATCH'
+ - 'DELETE'
# Install npm and run:
$ npm install
# Start the development server:
$ npm run dev-server
# Start coding into assets/js/pages/ 🎉
# First you need to build both client and server bundles
$ npm run build
# Start/Stop the SSR Server
$ symfony console inertia:start-ssr
$ symfony console inertia:stop-ssr