A modern, Bootstrap 5-powered Yii2 application template designed for rapid web-application development. Built with best practices, clean architecture, and developer-friendly configuration, it lets you create production-ready apps with minimal setup while maintaining code quality and extensibility.
- ✅ Asset Management - Optimized asset bundles for CSS, JS, and resource management.
- ✅ Clean Architecture - Well-organized directory structure following Yii2 best practices.
- ✅ Console Commands - Example console commands for background tasks and maintenance.
- ✅ Contact Form - Fully functional contact form with validation and email sending.
- ✅ Developer Tools - Debugging tools, logging, and development-friendly configurations.
- ✅ Modern Bootstrap 5 UI - Responsive, mobile-first design with latest Bootstrap components.
- ✅ Multi-language Support - Built-in internationalization (i18n) support with message translations.
- ✅ Ready-to-Use Pages - Pre-built pages including home, about, contact, and error handling.
- ✅ Security Features - Built-in CSRF protection, input validation, and secure configurations.
- ✅ SSL Support - Configured for secure HTTPS connections with SSL (mkcert).
- ✅ Testing Ready - Codeception test suite with examples for functional and unit testing.
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.
- 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.
Quick start
composer create-project --prefer-dist --stability=dev yii2-extensions/app-basic myapp
cd myapp
Start development server
# Using built-in PHP server
php -S localhost:8080 -t public
# Or using Yii console command
./yii serve
Start Apache or Nginx server
# For Apache
docker-compose up -d
# For Caddy
docker-compose -f docker-compose.caddy.yml up -d
# For FrankenPHP
docker-compose -f docker-compose.frankenphp.yml up -d
# For Nginx
docker-compose -f docker-compose.nginx.yml up -d
After starting the server, you can access your application in your web browser.
# For built-in PHP server
http://localhost:8080/
# For Apache
https://localhost:8443/
# For Caddy
https://localhost:8444/
# For FrankenPHP
https://localhost:8445/
# For Nginx
https://localhost:8446/
root/
├── config/ Configuration files
│ ├── common/ Common configuration
│ ├── console/ Console configuration
│ ├── web/ Web configuration
│ └── messages.php Translation config
├── docker/ Docker configuration files
│ ├── apache/ Apache configuration
│ ├── caddy/ Caddy configuration
│ ├── frankenphp/ FrankenPHP configuration
│ ├── nginx/ Nginx configuration
│ ├── php/ PHP configuration
│ ├── ssl/ SSL certificates
│ └── supervisor/ Supervisor configuration
├── src/
│ ├── framework/ Framework assets & resources
│ │ ├── asset/ Asset bundles
│ │ ├── event/ Event handlers
│ │ └── resource/ CSS, JS, layouts, messages
│ └── usecase/ Application use cases
│ ├── contact/ Contact functionality
│ ├── hello/ Console command example
│ ├── security/ Security features
│ └── site/ Site pages
├── tests/ Test suites
├── vendor/ Composer dependencies
└── public/ Web server document root
<?php
// src/usecase/site/SiteController.php
declare(strict_types=1);
namespace app\usecase\site;
use yii\web\Controller;
class SiteController extends Controller
{
public function actionIndex(): string
{
return $this->render('index');
}
public function actionAbout(): string
{
return $this->render('about');
}
}
# Run the hello command
./yii hello/index
# Generate translations
./yii message config/messages.php
# Clear cache
./yii cache/flush-all
For detailed configuration options and advanced usage:
The web application includes these ready-to-use pages:
- Home Page - Welcome page with navigation
- About Page - Information about your application
- Contact Page - Contact form with validation
- 404 Error Page - Custom error handling