PHPackages                             nytodev/inertia-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. nytodev/inertia-bundle

ActiveSymfony-bundle[Framework](/categories/framework)

nytodev/inertia-bundle
======================

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

v3.0.2(3w ago)7189↓40%[1 PRs](https://github.com/nytodev/inertia-bundle/pulls)MITPHPPHP ^8.1CI failing

Since Apr 5Pushed 1w ago1 watchersCompare

[ Source](https://github.com/nytodev/inertia-bundle)[ Packagist](https://packagist.org/packages/nytodev/inertia-bundle)[ Docs](https://github.com/nytodev/inertia-bundle)[ RSS](/packages/nytodev-inertia-bundle/feed)WikiDiscussions 3.x Synced 1w ago

READMEChangelog (7)Dependencies (16)Versions (19)Used By (0)

Inertia.js Symfony Bundle
=========================

[](#inertiajs-symfony-bundle)

Symfony bundle implementing the [Inertia.js](https://inertiajs.com/) v3 server-side protocol — the Symfony equivalent of [`inertiajs/inertia-laravel`](https://github.com/inertiajs/inertia-laravel).

[![Tests](https://github.com/nytodev/inertia-bundle/actions/workflows/tests.yml/badge.svg)](https://github.com/nytodev/inertia-bundle/actions/workflows/tests.yml)[![Latest Version](https://camo.githubusercontent.com/7b4131341eb2b8723497beb77112cc44e124ace5218c023c148fa6462b7832c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e79746f6465762f696e65727469612d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nytodev/inertia-bundle)[![PHP](https://camo.githubusercontent.com/6dccc680b1780bc488cfde5364c26b90f45597be38bb826ecd3e042d86bfef7d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6e79746f6465762f696e65727469612d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nytodev/inertia-bundle)[![License](https://camo.githubusercontent.com/42af1cf68e0b24a94012426b1dadbff14aba052f4f0caff992ac7733ee9a408f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e79746f6465762f696e65727469612d62756e646c652e7376673f7374796c653d666c61742d737175617265)](LICENSE)

---

What is Inertia.js?
-------------------

[](#what-is-inertiajs)

Inertia lets you build modern React, Vue, or Svelte single-page applications without building a separate API. You keep your Symfony controllers, routing, middleware, and authentication exactly as they are - controllers just return a component name and props instead of a Twig template.

On the first visit the server returns a full HTML page. On subsequent navigations it returns a lightweight JSON response and the JavaScript adapter swaps the component client-side without a full reload.

---

Requirements
------------

[](#requirements)

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

---

Installation
------------

[](#installation)

```
composer require nytodev/inertia-bundle
```

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

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

---

Quick start
-----------

[](#quick-start)

### 1. Root Twig template

[](#1-root-twig-template)

```
{# templates/base.html.twig #}

    {{ inertiaHead(page) }}
    {{ encore_entry_link_tags('app') }}

    {{ inertia(page) }}
    {{ encore_entry_script_tags('app') }}

```

`inertia(page)` outputs `...`.
`inertiaHead(page)` outputs SSR-rendered head tags (safe to include even without SSR).

### 2. Controller

[](#2-controller)

```
use Nytodev\InertiaBundle\Service\Inertia;

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

    #[Route('/users/{id}')]
    public function show(User $user, Inertia $inertia): Response
    {
        return $inertia->render('Users/Show', [
            'user' => $user,
        ]);
    }
}
```

### 3. JavaScript entry point (React)

[](#3-javascript-entry-point-react)

```
npm install @inertiajs/react react react-dom
```

```
// assets/app.jsx — @inertiajs/react v3 (setup is optional, Inertia calls createRoot automatically)
import { createInertiaApp } from '@inertiajs/react'

createInertiaApp({
    resolve: name => {
        const pages = import.meta.glob('./Pages/**/*.jsx', { eager: true })
        return pages[`./Pages/${name}.jsx`]
    },
})
```

### 4. A page component

[](#4-a-page-component)

```
// assets/Pages/Users/Index.jsx
export default function UsersIndex({ users }) {
    return (

            {users.map(user => (
                {user.name}
            ))}

    )
}
```

That's it. The bundle handles first-visit HTML, subsequent XHR JSON responses, asset versioning, 302→303 redirect conversion, and partial reloads automatically.

---

Shared props
------------

[](#shared-props)

Set props that are available on every page (e.g. authenticated user, flash messages):

```
// src/EventListener/InertiaShareListener.php
class InertiaShareListener
{
    public function __construct(
        private readonly Inertia $inertia,
        private readonly Security $security,
    ) {}

    public function onKernelRequest(RequestEvent $event): void
    {
        $this->inertia->share('auth', [
            'user' => $this->security->getUser()?->getUserIdentifier(),
        ]);
    }
}
```

```
# config/services.yaml
App\EventListener\InertiaShareListener:
    tags:
        - { name: kernel.event_listener, event: kernel.request }
```

---

Prop types
----------

[](#prop-types)

MethodBehaviour`$inertia->lazy(fn)` / `optional(fn)`Never sent on full render, only on explicit partial reload`$inertia->always(fn)`Always sent, even in partial reloads that filter other props`$inertia->defer(fn)`Fetched by the client in a separate XHR after page load`$inertia->once(fn)`Sent once, cached by the client`$inertia->merge(fn)`Merged into the existing client value (infinite scroll)```
return $inertia->render('Feed/Index', [
    'posts'    => $inertia->merge(fn () => $this->postRepo->paginate($page)),
    'stats'    => $inertia->defer(fn () => $this->buildStats()),
    'comments' => $inertia->lazy(fn () => $this->commentRepo->findAll()),
]);
```

---

Configuration
-------------

[](#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
    expose_shared_prop_keys: true # Expose shared prop keys as top-level `sharedProps` in page object
    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
```

---

Documentation
-------------

[](#documentation)

TopicLinkInstallation &amp; configuration[docs/installation.md](docs/installation.md)Rendering &amp; shared props[docs/rendering.md](docs/rendering.md)All prop types[docs/props.md](docs/props.md)Asset versioning, redirects, history[docs/features.md](docs/features.md)Flash &amp; validation errors[docs/flash-errors.md](docs/flash-errors.md)Server-Side Rendering[docs/ssr.md](docs/ssr.md)Testing[docs/testing.md](docs/testing.md)---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance97

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 99% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

9

Last Release

25d ago

Major Versions

v2.0.2 → v3.0.02026-04-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/45fbc6e6cd12b25dec4a1a5f2de756a1cf5b9b18f83fcb1b23ccf9c887622b7c?d=identicon)[nytodev](/maintainers/nytodev)

---

Top Contributors

[![nytodev](https://avatars.githubusercontent.com/u/56875519?v=4)](https://github.com/nytodev "nytodev (102 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

---

Tags

inertiajsphpreactspasveltesymfonysymfony-bundlevuesymfonybundleinertiareactinertiajsvuesvelteSPA

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nytodev-inertia-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/nytodev-inertia-bundle/health.svg)](https://phpackages.com/packages/nytodev-inertia-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M370](/packages/easycorp-easyadmin-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M195](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M506](/packages/shopware-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9017.2k55](/packages/open-dxp-opendxp)[chameleon-system/chameleon-base

The Chameleon System core.

1027.9k4](/packages/chameleon-system-chameleon-base)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
