crenspire / yii3-react-starter
Yii3 - Modern Starter Kit Using Inertia v2, React 19, ShadCN UI and Tailwind CSS 4+
Fund package maintenance!
Opencollective
yiisoft
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Type:project
pkg:composer/crenspire/yii3-react-starter
Requires
- php: ^8.2
- ext-filter: *
- crenspire/yii3-inertia: ^1.0
- httpsoft/http-message: ^1.1.6
- 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
- symfony/console: ^7.3.2
- yiisoft/aliases: ^3.1
- yiisoft/assets: ^5.1.1
- yiisoft/config: ^1.6
- yiisoft/csrf: ^2.2.2
- yiisoft/data-response: ^2.1.1
- yiisoft/definitions: ^3.4
- yiisoft/di: ^1.4
- yiisoft/error-handler: ^4.2
- yiisoft/html: ^3.11
- yiisoft/http: ^1.2
- yiisoft/input-http: ^1.0
- yiisoft/log: ^2.1.1
- yiisoft/log-target-file: ^3.0
- yiisoft/middleware-dispatcher: ^5.3
- yiisoft/request-provider: ^1.2
- yiisoft/router: ^4
- yiisoft/router-fastroute: ^4.0.1
- yiisoft/session: ^3.0
- yiisoft/view: ^12.2.1
- yiisoft/yii-console: ^2.3
- yiisoft/yii-http: ^1.0.4
- yiisoft/yii-runner-console: ^2.2
- yiisoft/yii-runner-http: ^3.2
- yiisoft/yii-view-renderer: ^7.3
Requires (Dev)
- codeception/c3: ^2.9
- codeception/codeception: ^5.3.2
- codeception/module-asserts: ^3.2
- codeception/module-cli: ^2.0.1
- codeception/module-phpbrowser: ^3.0.1
- friendsofphp/php-cs-fixer: ^3.86.0
- phpunit/phpunit: ^11.5.34
- rector/rector: ^2.1.4
- roave/infection-static-analysis-plugin: ^1.39
- roave/security-advisories: dev-latest
- shipmonk/composer-dependency-analyser: ^1.8.3
- vimeo/psalm: ^6.13.1
This package is auto-updated.
Last update: 2026-01-23 13:01:29 UTC
README
A modern, production-ready starter kit for building fast applications with Yii3, Inertia.js, React, and Tailwind CSS.
๐ Features
- 10x Dev Experience - Ship faster with opinionated PHP CS Fixer, maximum Psalm level, and Rector for enhanced code quality and developer productivity
- Production Docker Ready - Optimized Docker images with Yii3 and optimized setup for lightning-fast development and deployment
- Advanced Authentication - Complete authentication system with social login and role-based access control ready to implement
- Payment Ready - Payment integration ready for subscription billing and payment processing so you can focus on building your product
- API Ready - RESTful API endpoints with authentication and comprehensive documentation structure ready to implement
- Customizable UI - Built with shadcn/ui components, making UI customization a breeze. Easily modify themes, styles, and components to match your brand
- AI Integration Ready - Pre-configured structure for LLM integrations. Build AI-powered features into your app with minimal setup
- Admin Panel Ready - Structure ready for beautiful admin panel with CRUD operations, charts, and detailed analytics integration
- Evolving Features - Regular updates bring new features, integrations, and improvements to supercharge your development
๐ Tech Stack
Backend
- PHP 8.2+ - Modern PHP with latest features
- Yii3 - High-performance PHP framework
- Inertia.js 2.0 - Modern monolith approach
- Composer - PHP dependency management
Frontend
- React 18 - Modern UI library
- Inertia.js React - Seamless SPA experience
- Vite 5 - Lightning-fast build tool
- Tailwind CSS 4+ - Utility-first CSS framework
- shadcn/ui - Beautiful, accessible components
- Lucide React - Beautiful icon library
Development Tools
- PHP CS Fixer - Code style enforcement
- Psalm - Static analysis (maximum level)
- Rector - Automated refactoring
- Docker - Containerized development environment
๐ Requirements
- PHP 8.2 or higher
- Composer 2.x
- Node.js 18+ and npm/yarn
- Docker (optional, for containerized setup)
๐ Installation
1. Clone the repository
git clone https://github.com/your-org/yii3-react-starter-kit.git
cd yii3-react-starter-kit
2. Install PHP dependencies
composer install
3. Install Node.js dependencies
npm install
# or
yarn install
4. Build frontend assets
npm run build
# or
yarn build
5. Start the development server
# Start PHP server composer serve # In another terminal, start Vite dev server npm run dev # or yarn dev
Visit http://localhost:8080 to see your application.
๐จ Development Workflow
Frontend Development
The starter kit uses Vite for fast development with Hot Module Replacement (HMR):
# Start Vite dev server (enables HMR) npm run dev # Build for production npm run build
Note: The Vite dev server runs on port 5173, while the PHP server runs on port 8080. The application automatically detects and uses the dev server when available.
Backend Development
# Start PHP development server composer serve # Run tests composer test # Code style check composer cs-check # Code style fix composer cs-fix # Static analysis composer psalm
๐ Project Structure
yii3-react-starter-kit/
โโโ assets/
โ โโโ react/
โ โโโ src/
โ โโโ components/ # React components
โ โ โโโ ui/ # shadcn/ui components
โ โ โโโ Layout.jsx
โ โ โโโ Navigation.jsx
โ โ โโโ Footer.jsx
โ โ โโโ ...
โ โโโ pages/ # Inertia page components
โ โโโ lib/ # Utility functions
โ โโโ main.jsx # React entry point
โ โโโ app.css # Global styles
โโโ config/ # Yii3 configuration
โ โโโ common/ # Shared configuration
โ โโโ web/ # Web-specific configuration
โโโ src/
โ โโโ Controller/ # PHP controllers
โ โโโ views/ # Inertia root template
โ โโโ ...
โโโ public/ # Public web root
โ โโโ dist/ # Built frontend assets
โโโ docker/ # Docker configuration
โโโ tests/ # Test suites
โโโ composer.json # PHP dependencies
โโโ package.json # Node.js dependencies
โโโ vite.config.js # Vite configuration
โโโ tailwind.config.js # Tailwind CSS configuration
๐ฏ Usage
Creating a New Page
- Create a React component in
assets/react/src/pages/:
// assets/react/src/pages/About.jsx import React from 'react'; import Layout from '@/components/Layout'; export default function About() { return ( <Layout> <div className="container mx-auto px-4 py-20"> <h1 className="text-4xl font-bold">About Us</h1> <p>Your content here...</p> </div> </Layout> ); }
- Register the component in
assets/react/src/main.jsx:
import About from './pages/About'; createInertiaApp({ resolve: (name) => { const pages = { Home, About, // Add your new page }; return pages[name]; }, // ... });
- Create a PHP controller in
src/Controller/:
<?php namespace App\Controller\About; use Crenspire\Inertia\Action\InertiaAction; use Psr\Http\Message\ResponseInterface; final class Action extends InertiaAction { public function __invoke(): ResponseInterface { return $this->render('About', [ // Your page data ]); } }
- Add a route in
config/common/routes.php:
Route::get('/about', [\App\Controller\About\Action::class, '__invoke'])->name('about');
Using shadcn/ui Components
The starter kit includes shadcn/ui components. To add more:
# Example: Add a new component (if you have shadcn CLI)
npx shadcn-ui@latest add button
Components are located in assets/react/src/components/ui/.
Dark Mode
Dark mode is automatically handled with localStorage persistence. The theme toggle is available in the navigation header.
๐งช Testing
# Run all tests composer test # Run specific test suite vendor/bin/codecept run unit vendor/bin/codecept run functional
๐ณ Docker Setup
Development
cd docker/dev
docker-compose up -d
Production
cd docker/prod
docker-compose up -d
๐ Code Quality
The starter kit includes several tools for maintaining code quality:
- PHP CS Fixer - Enforces PSR-12 coding standards
- Psalm - Static analysis at maximum level
- Rector - Automated refactoring and upgrades
# Check code style composer cs-check # Fix code style composer cs-fix # Run static analysis composer psalm # Run Rector vendor/bin/rector process src/
๐ง Configuration
Inertia.js Configuration
Inertia.js settings can be configured in config/common/params-inertia.php:
'inertia' => [ 'assetConfig' => [ 'viteHost' => 'localhost', 'vitePort' => 5173, 'viteEntryPath' => 'assets/react/src/main.jsx', // ... ], ],
Tailwind CSS
Tailwind configuration is in tailwind.config.js. The starter kit includes shadcn/ui theme configuration.
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ License
This project is open-sourced software licensed under the MIT license.
๐ Acknowledgments
- Yii Framework - The PHP framework
- Inertia.js - The modern monolith approach
- React - The UI library
- shadcn/ui - The component library
- Vite - The build tool
๐ Support
- Issues: GitHub Issues
- Documentation: Wiki
- Discussions: GitHub Discussions
Built with โค๏ธ for the Yii3 community