yii3 / app-inertia-vue
A Yii 3 application template powered by Inertia 3 and Vue 3.
Package info
github.com/yii3/app-inertia-vue
Language:CSS
Type:project
pkg:composer/yii3/app-inertia-vue
Requires
- php: >=8.3
- ext-filter: *
- httpsoft/http-message: ^1.1.6
- php-forge/debug: ^0.2
- php-forge/foxy: ^0.3
- php-forge/inertia: ^0.4
- php-forge/vite: ^0.4
- psr/container: ^2.0.2
- psr/http-factory: ^1.1
- psr/http-message: ^2.0
- psr/http-server-handler: ^1.0.2
- psr/log: ^3.0.2
- vlucas/phpdotenv: ^5.7.0
- yii3/inertia: ^0.1
- yiisoft/aliases: ^3.1.1
- yiisoft/config: ^1.6.2
- yiisoft/csrf: ^2.2.3
- yiisoft/definitions: ^3.4.1
- yiisoft/di: ^1.4.1
- yiisoft/error-handler: ^4.3.2
- yiisoft/html: ^4.2
- yiisoft/http: ^1.3
- yiisoft/log: ^2.2.1
- yiisoft/middleware-dispatcher: ^5.4
- yiisoft/request-body-parser: ^1.2.1
- yiisoft/request-provider: ^1.3
- yiisoft/router: ^4.0.2
- yiisoft/router-fastroute: ^4.0.3
- yiisoft/session: ^3.0.2
- yiisoft/yii-http: ^1.1.1
- yiisoft/yii-runner-console: ^2.2.1
- yiisoft/yii-runner-http: ^3.2.1
Requires (Dev)
- codeception/c3: ^2.9
- codeception/codeception: ^5.3.5
- codeception/module-phpbrowser: ^4.1
- maglnet/composer-require-checker: ^4.20
- php-forge/coding-standard: ^0.3.4
- phpstan/extension-installer: ^1.4.3
- phpstan/phpstan: ^2.2.14
- phpstan/phpstan-strict-rules: ^2.0.12
- rector/rector: ^2.6.7
- symfony/process: ^7.4.13 || ^8.1.7
- yii3/debug: ^0.1@dev
- yiisoft/db: ^2.0.1
- yiisoft/db-sqlite: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-16 22:14:49 UTC
README
Inertia.js + Vue 3 Application Template
Reference Yii 3 application with Inertia.js + Vue 3 integration
Server-driven SPA with TypeScript, Vite 8, persistent dark mode, and browser-level tests
Yii owns routing and page data, Inertia carries navigation state, and Vue renders the interface
Features
- Architecture presents a constructor-injected invokable action and the explicit PSR-15 middleware pipeline that handles each request.
- Stack shows the Yii, Inertia, Vue, and Vite responsibilities in one server-driven request flow.
- Partial reloads refresh only the
runtimepage prop while preserving the persistent layout, deferred data, and scroll position. - Deferred props resolve the
ecosystemdiagnostics group after the first response, with an accessible loading state in Vue. - Infinite scroll exposes
requestFeedthroughProp::scroll(). The server provides cursor metadata, Inertia mergesrequestFeed.data, and Vue appends each three-event page inside a contained scroll region. - Persistent theme follows the operating-system light and dark preference until the visitor chooses a mode, then stores that choice locally.
Requirements
Quick start
# create a new Yii 3 application using the Inertia.js + Vue 3 template composer create-project --prefer-dist yii3/app-inertia-vue:^0.1@dev app-vue # navigate to the application directory cd app-vue # install the locked Node.js dependencies npm ci # build production assets (one-shot; for live editing see the HMR workflow below) npm run build # start the development server on port 8081 APP_ENV=debug APP_DEBUG=true ./yii serve
Open http://localhost:8081.
Development workflow with HMR
npm run build produces production assets once and exits. To edit .vue files and see changes in the browser without
rebuilding, run two processes side by side:
# Terminal 1 — Vite dev server (HMR for .vue and the application stylesheet) npm run dev # Terminal 2 — Yii 3 in dev mode APP_ENV=dev APP_DEBUG=true ./yii serve
How the pieces connect:
- The PHP application continues to own routing and the initial HTML response.
config/params.phpreads theAPP_ENVenvironment variable. When it equalsdev, the framework-agnostic Vite facade is built withDevelopmentConfiguration, and the root view emits<script>tags pointing athttp://127.0.0.1:5173instead of the built manifest. Every other environment usesProductionConfiguration, wherePHPForge\Vite\Viteowns loading and cachingpublic/build/.vite/manifest.json.- Vue HMR is carried natively by
@vite/clienttogether with@vitejs/plugin-vue; no additional preamble is required. - The manifest's SHA-256 hash provides the Inertia asset version, so clients reload after built asset references change.
- Before deploying, stop the Vite dev server, run
npm run build, and setAPP_ENVtoprod, then servepublic/.
For manifest options, development-server behavior, and CORS configuration, see the
php-forge/vite documentation.
Debugger
yii3/debug is a development dependency. The package contributes its toolbar to the application's
yiisoft/middleware-dispatcher parameters without an application middleware reference to the debugger. The application
explicitly composes the Inertia collector, panel, and page observer with the Vite collector and panel in its debug,
dev, and test environments. Production keeps that integration absent without runtime package detection.
The package owns the local-only /debug, /debug/view, /debug/php-info, and /debug/toolbar routes and their Yii IP
filtering. A captured Inertia response adds an Inertia chip linked to its component, page metadata, props, negotiation
headers, and redacted raw payload. Vite adds its runtime mode and exposes normalized configuration and production
manifest chunks.
Project map
config/routes.php Named Yii 3 routes
config/di/application.php Application and Vite DI definitions
config/environments/debug/ Explicit non-production debugger integration
config/params.php Vite, middleware, Inertia, and application parameters
public/index.php Dotenv and HTTP application bootstrap
resources/js/app.ts Typed Inertia and Vue bootstrap
resources/js/composables/ Persistent theme state
resources/js/layouts/ Persistent Vue application shell
resources/js/pages/Home.vue Home page and Inertia demonstrations
resources/js/styles/app.css Application visual system
resources/views/app.php Initial Inertia HTML document
src/Web/Workbench/HomeAction.php Home props and scroll pagination
tests/Web/ Essential browser-level application tests
Quality checks
npm run typecheck npm run build composer tests composer static composer check-dependencies vendor/bin/ecs check --ansi
PHPStan runs at maximum level. Use composer ecs when you intentionally want to apply coding-standard fixes. The Web
suite covers the home page, its feed pagination, and the application-owned 404 response without duplicating tests for
framework or tooling packages.