yii2-framework/inertia-vue
最新稳定版本:0.1.0
Composer 安装命令:
composer require yii2-framework/inertia-vue
包简介
Vue adapter helpers for yii2.
README 文档
README
Inertia Vue
Vue adapter helpers for yii2-extensions/inertia
Vue-friendly root view and Vite asset integration for Yii2 Inertia applications
Features
Overview
yii2-extensions/inertia-vue is a thin PHP-side adapter package for building Vue-based Inertia applications on top of
yii2-extensions/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-extensions/inertia-vue:^0.1
Register the Vue bootstrap class:
return [ 'bootstrap' => [ \yii\inertia\vue\Bootstrap::class, ], 'components' => [ 'inertiaVue' => [ 'class' => \yii\inertia\Vite::class, 'baseUrl' => '@web/build', 'devMode' => YII_ENV_DEV, 'devServerUrl' => 'http://localhost:5173', 'entrypoints' => [ 'resources/js/app.js', ], 'manifestPath' => '@webroot/build/.vite/manifest.json', ], ], ];
Use only yii\inertia\vue\Bootstrap::class in the bootstrap list. It already delegates the base
yii2-extensions/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); }, });
Development mode
When devMode is true, the Vite helper bypasses the production manifest and emits @vite/client plus each
entrypoints script pointing at devServerUrl. Vue HMR is carried natively by @vite/client together with
@vitejs/plugin-vue; no extra preamble is needed.
Run the Vite dev server and the Yii2 application side by side:
# Terminal 1 — Vite dev server npm run dev # Terminal 2 — Yii2 in dev mode YII_ENV=dev ./yii serve
See Development Notes for the full HMR workflow, CORS notes, and troubleshooting.
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
Package information
Quality code
License
yii2-framework/inertia-vue 适用场景与选型建议
yii2-framework/inertia-vue 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.35k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2026 年 04 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「yii2」 「SPA」 「vue」 「inertia」 「vite」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 yii2-framework/inertia-vue 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yii2-framework/inertia-vue 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 yii2-framework/inertia-vue 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A component that allows creating responsive HTML tables or lists from data object
A custom URL rule class for Yii 2 which allows to create translated URL rules
A Laravel-Nuxt starter project template.
Admin panel generator for Laravel 8 and based on Vuetify Admin, a separate SPA admin framework running on top of REST APIs.
Appui DOM Interface
Code generation for MPMG projects that use Laravel and VueJs tecnologies.
统计信息
- 总下载量: 1.35k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2026-04-03