Skip to content

yii2-extensions/app-basic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii Framework

Web Application Basic

php-version Yii2 2.0.53 Yii2 22.0 PHPUnit PHPStan

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.

app-basic

Features

  • 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.

Supported web servers

Apache Caddy FrankenPHP Nginx

Quick start

How it works

The Yii2 Web Application Basic template provides a complete foundation for building modern web applications. Unlike starting from scratch, this template includes.

  1. Pre-configured structure with organized directories for assets, views, models, and controllers.
  2. Bootstrap 5 integration for responsive, mobile-first user interfaces.
  3. Security features including CSRF protection and input validation.
  4. 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.

Installation

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 

Access your application

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/

Basic usage

Directory structure

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

Creating your first page

<?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');
    }
}

Console commands

# Run the hello command
./yii hello/index

# Generate translations
./yii message config/messages.php

# Clear cache
./yii cache/flush-all

Quality code

Latest Stable Version Total Downloads codecov phpstan-level StyleCI

Documentation

For detailed configuration options and advanced usage:

Screenshots

The web application includes these ready-to-use pages:

Our social networks

X

License

License

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy