yii2-extensions / app-inertia-react
Yii2 application template with Inertia.js and React 19
Package info
github.com/yii2-extensions/app-inertia-react
Type:project
pkg:composer/yii2-extensions/app-inertia-react
Requires
- php: >=8.3
- php-forge/foxy: ^0.2
- yii2-extensions/inertia: ^0.1
- yii2-extensions/inertia-react: ^0.1
- yiisoft/yii2: ^22.0@dev
- yiisoft/yii2-symfonymailer: ^4.0
Requires (Dev)
- codeception/c3: ^2.9
- codeception/codeception: ^5.3
- codeception/lib-innerbrowser: ^4.1
- codeception/module-asserts: ^3.3
- codeception/module-filesystem: ^3.0
- codeception/module-phpbrowser: ^4.0
- codeception/module-yii2: ^2.0
- codeception/verify: ^3.4
- maglnet/composer-require-checker: ^4.1
- php-forge/coding-standard: ^0.1
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-strict-rules: ^2.0.3
- yii2-extensions/phpstan: ^0.4
This package is auto-updated.
Last update: 2026-04-17 10:18:59 UTC
README
Inertia.js + React 19 Application Template
Skeleton Yii2 application with Inertia.js + React 19 integration
Server-driven SPA with Tailwind CSS v4, shadcn/ui, dark mode, Cloudflare Turnstile, and Codeception tests
Use the "Use this template" button on GitHub to create your own repository from this template.
Features
Quick start
# create a new Yii2 application using the Inertia.js + React 19 template composer create-project --prefer-dist yii2-extensions/app-inertia-react:^0.1@dev app-react # navigate to the application directory cd app-react # run database migrations ./yii migrate/up # build production assets (one-shot; for live editing see the HMR workflow below) npm run build # start the development server ./yii serve
Development workflow with HMR
npm run build produces production assets once and exits. To edit .jsx
files and see changes in the browser without rebuilding, run two processes
side by side:
# Terminal 1 โ Vite dev server (HMR for .jsx and Tailwind CSS) npm run dev # Terminal 2 โ Yii2 in dev mode YII_ENV=dev ./yii serve
How the pieces connect:
public/index.phpreads theYII_ENVenvironment variable. When it equalsdev,inertiaReact.devModeevaluates totrueinconfig/web.php, and the root view emits<script>tags pointing athttp://localhost:5173instead of the built manifest.- React Fast Refresh is wired automatically through
\yii\inertia\react\Bootstrap::reactRefreshPreambleProvider(). Edits to.jsxfiles and CSS update in place without a full page reload. - Before deploying, stop the Vite dev server, run
npm run build, unsetYII_ENV(or set it toprod), and servepublic/. Production mode reads hashed assets frompublic/build/via the Vite manifest.
For CORS guidance on non-localhost setups (Docker, tunnels, reverse proxies), troubleshooting, and the full production-switch procedure, see the adapter's Development Notes.
Docker
docker compose up -d
Documentation
- ๐ Installation Guide
- โ๏ธ Configuration Reference
- ๐ก Usage Examples
- ๐งช Testing Guide