yii2-framework / inertia-vue
Vue adapter helpers for yii2.
Requires
- php: >=8.2
- yii2-framework/inertia: ^0.1@dev
- yii2-framework/yii2: ^0.1@dev
Requires (Dev)
- infection/infection: ^0.32
- maglnet/composer-require-checker: ^4.1
- php-forge/coding-standard: ^0.1
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0.3
- phpunit/phpunit: ^10.5
- xepozz/internal-mocker: ^1.4
- yii2-extensions/phpstan: ^0.4
This package is auto-updated.
Last update: 2026-04-03 20:26:52 UTC
README
Inertia Vue
Vue adapter helpers for yii2-framework/inertia
Vue-friendly root view and Vite asset integration for Yii2 Inertia applications
Features
Overview
yii2-framework/inertia-vue is a thin PHP-side adapter package for building Vue-based Inertia applications on top of
yii2-framework/inertia.
This package does not install npm dependencies for you. Instead, it provides:
- a Vue-specific bootstrap class for Yii2;
- a default root view that outputs Vite tags plus the initial Inertia page payload;
- a Vite helper component for development-server and manifest-driven production assets;
- documentation and conventions for the application-owned Vue client entrypoint.
Installation
composer require yii2-framework/inertia-vue:^0.1
Register the Vue bootstrap class:
return [ 'bootstrap' => [\yii\inertia\vue\Bootstrap::class], 'components' => [ 'inertiaVue' => [ 'class' => \yii\inertia\vue\Vite::class, 'manifestPath' => '@webroot/build/.vite/manifest.json', 'baseUrl' => '@web/build', 'entrypoints' => ['resources/js/app.js'], 'devMode' => YII_ENV_DEV, 'devServerUrl' => 'http://localhost:5173', ], ], ];
Use only yii\inertia\vue\Bootstrap::class in the bootstrap list. It already delegates the base
yii2-framework/inertia bootstrap.
Vue client entrypoint
Install the client-side dependencies in your application project:
npm install vue @vitejs/plugin-vue @inertiajs/vue3 vite
Then create your client entrypoint, for example resources/js/app.js:
import { createApp, h } from "vue"; import { createInertiaApp } from "@inertiajs/vue3"; createInertiaApp({ resolve: (name) => { const pages = import.meta.glob("./Pages/**/*.vue", { eager: true }); return pages[`./Pages/${name}.vue`]; }, setup({ el, App, props, plugin }) { createApp({ render: () => h(App, props) }) .use(plugin) .mount(el); }, });
Production asset integration
This package expects a Vite manifest file generated with build.manifest = true. In production it will render:
- style sheet tags for the entrypoint chunk and its imported chunks;
- module entry scripts for each entrypoint;
- optional
modulepreloadtags for imported JavaScript chunks.
Documentation
For detailed configuration options and advanced usage.
- ๐ Installation Guide
- โ๏ธ Configuration Reference
- ๐ก Usage Examples
- ๐งช Testing Guide
- ๐ ๏ธ Development Notes