yii2-extensions / inertia
Yii2 adapter for the framework-agnostic Inertia.js PHP protocol core.
Requires
- php: >=8.3
- php-forge/inertia: ^0.5
- psr/event-dispatcher: ^1.0
- yiisoft/yii2: ^22.0@dev
Requires (Dev)
- infection/infection: ^0.35
- maglnet/composer-require-checker: ^4.1
- php-forge/coding-standard: ^0.3
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0.3
- phpunit/phpunit: ^12.5
- xepozz/internal-mocker: ^1.4
- yii2-extensions/phpstan: ^0.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-23 15:59:00 UTC
README
Inertia for Yii2
Connect Yii requests, responses, views, sessions, and redirects to the Inertia protocol
Architecture
php-forge/inertia owns the Inertia protocol, page model, prop resolution,
headers, redirects, and result objects. This package connects that core to Yii requests, responses, views, and sessions.
The application supplies its JavaScript client, component resolver, and asset build.
Installation
Yii 2.0.x is outside this package's declared support.
composer require yii2-extensions/inertia:^0.6
See the installation guide for Yii development-line resolution, bootstrap registration, CSRF configuration, and frontend setup.
Quick start
Register the adapter in the existing web application configuration:
'bootstrap' => [\yii\inertia\Bootstrap::class],
Return a page from an existing controller action:
return \yii\inertia\Inertia::render('Dashboard', ['stats' => ['visits' => 42]]);
A normal visit renders HTML; an Inertia visit returns a JSON page. The default view supplies the page payload but loads no frontend bundle. Continue with configuration and the usage examples to connect the application's client.
Documentation
Practical guides and application recipes, with exact contracts in PHPDoc.
- ๐ Installation guide: Composer, bootstrap, CSRF, and frontend setup.
- โ๏ธ Configuration and adapter reference: manager options, props, root views, and responses.
- ๐ก Usage examples: controllers, prop recipes, validation, and redirects.
- ๐ Upgrade guide and migration guide: application changes for existing installations.
- ๐งช Testing guide: PHPUnit, static analysis, mutation, and documentation checks.
The guides and the API reference generated from
the PHPDoc in src/ are published at https://yii2-framework.github.io/docs/extensions/inertia/.
AI assistance
AI agents: read the documentation index and fetch the Markdown version
of a page by appending index.md to its URL. The
AI agents guide covers skill installation, client setup and
verification.
- ๐ค
yii2-inertia-integrationskill: Inertia integration. - ๐งญ
yii2-frameworkskill: Yii 22.0 application conventions.
The hosted documentation covers Yii 22.0. If it does not match the installed revision or is unavailable, use the repository guides, the skill source, the source PHPDoc and the changelog.