A modern, Bootstrap 5-powered Yii2 application template for rapid development
Clean architecture, production-ready features, and developer-friendly configuration
The Yii2 Web Application Basic template provides a complete foundation for building modern web applications. Unlike starting from scratch, this template includes.
- Pre-configured structure with organized directories for assets, views, models, and controllers.
- Bootstrap 5 integration for responsive, mobile-first user interfaces.
- Security features including CSRF protection and input validation.
- Development tools for debugging, logging, and testing.
Why use this template
- Rapid development: Start building features immediately without setup overhead.
- Best practices: Follow Yii2 conventions and modern web development standards.
- Extensible: Easy to customize and extend for specific project requirements.
- Production-ready: Includes security features and optimizations for deployment.
Note
Also, make sure to install npm for frontend dependency management.
composer create-project --prefer-dist yii2-extensions/app-basic:dev-road-runner app-basic
cd app-basicDownload and install RoadRunner first
./vendor/bin/rr get-binaryStart the server in daemon mode
./rr serve -dImportant
Your application will be available at https://localhost:8443 or at the address set in the rr.yaml file.
root/
├── config/ Configuration files
│ ├── common/ Common configuration
│ ├── console/ Console configuration
│ ├── web/ Web configuration
│ └── messages.php Translation config
├── src/
│ ├── framework/ Framework assets & resources
│ │ ├── asset/ Asset bundles
│ │ └── resource/ CSS, JS, layouts, messages
│ └── usecase/ Application use cases
│ ├── hello/ Console command example
│ └── site/ Site pages
├── tests/ Test suites
├── vendor/ Composer dependencies
└── web/ Web server document root
<?php
// src/usecase/site/SiteController.php
declare(strict_types=1);
namespace app\usecase\site;
use yii\web\Controller;
final class SiteController extends Controller
{
public function actionIndex(): string
{
return $this->render('index');
}
}# Run the hello command
./yii hello/index
# Generate translations
./yii message config/messages.php
# Clear cache
./yii cache/flush-allFor detailed configuration options and advanced usage: