nytodev/inertia-bundle

Symfony Bundle implementing the Inertia.js v2 server-side protocol

Maintainers

Package info

github.com/nytodev/inertia-bundle

Type:symfony-bundle

pkg:composer/nytodev/inertia-bundle

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v2.0.1 2026-04-05 16:24 UTC

README

Symfony bundle implementing the Inertia.js v2 server-side protocol — the Symfony equivalent of inertiajs/inertia-laravel.

Tests Latest Version PHP License

Requirements

PHP ^8.1 · Symfony ^6.4 / ^7.4 / ^8.0 · Twig ^3.0

Installation

composer require nytodev/inertia-bundle

Without Symfony Flex, register the bundle manually in config/bundles.php:

Nytodev\InertiaBundle\InertiaBundle::class => ['all' => true],

Configuration

# config/packages/inertia.yaml
inertia:
    root_view: base.html.twig   # Root Twig template (default: base.html.twig)
    version: null               # Asset version string — triggers full reload on change
    encrypt_history: false      # Globally encrypt browser history state
    ssr_enabled: false          # Enable SSR (requires symfony/http-client)
    ssr_url: 'http://127.0.0.1:13714'
    ssr_bundle: null            # Path to SSR JS bundle, auto-detected if null

Basic usage

use Nytodev\InertiaBundle\Service\Inertia;

#[Route('/users')]
public function index(Inertia $inertia): Response
{
    return $inertia->render('Users/Index', [
        'users' => $this->repository->findAll(),
    ]);
}

Your root Twig template:

<!DOCTYPE html>
<html>
<head>
    {{ inertiaHead(page) }}
</head>
<body>
    {{ inertia(page) }}
</body>
</html>

Documentation

Full documentation is available in docs/.

License

MIT — see LICENSE.