Yii 3.0 project template
Clone or download
Latest commit 6d664f0 Jan 8, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
config updated config Nov 23, 2018
public Moved in public `.htaccess` and `robots.txt` from yii-app Aug 22, 2018
runtime Added empty `runtime` directory Aug 15, 2018
.env.dist Added `.env.dist` Jul 23, 2018
.gitignore Added gitignore node_modules Dec 29, 2018
.scrutinizer.yml inited Jul 12, 2018
.travis.yml fixed test Nov 23, 2018
LICENSE inited Jul 12, 2018
README.md Fixes #17: made instructions cross-platform Nov 25, 2018
composer.json Fixing requires Dec 29, 2018
docker-compose.yml updated Docker image Jan 9, 2019
hidev.yml Fixed hidev config Aug 26, 2018


Yii Framework

Yii Framework Project Template

Yii Framework Project Template is a skeleton application best for rapidly creating projects.

The template contains the basic features including user login/logout and a contact page. It includes all commonly used configurations that would allow you to focus on adding new features to your application.

Latest Stable Version Total Downloads Build Status


config/             contains application configurations
public/             contains the entry script, published assets and other publicly available files e.g. favicon.ico and robots.txt
runtime/            contains files generated during runtime
vendor/             contains dependent 3rd-party packages


The minimum requirement by this project template that your Web server supports PHP 7.1.


If you do not have Composer, you may install it by following the instructions at getcomposer.org.

You can then install this project template using the following command:

composer create-project --prefer-dist --stability=dev yiisoft/yii-project-template myapp
cd myapp

This gives you an empty project, which you can add application templates to, see the following sections on how to add these.

Depending on your system you might need to give write permissions to ./runtime and ./public/assets

CLI application

If you want to install a console application, which is needed for running your own console commands, you can add it by requiring the yiisoft/yii-base-cli package.

composer require yiisoft/yii-base-cli

You can now run yii help to see the available commands.

API application

If you want to create an API, you can add it by requiring the yiisoft/yii-base-api package.

composer require yiisoft/yii-base-api
vendor/bin/yii serve -p 8081

You can access the API via http://localhost:8081/.

Web application

Since web-applications use client-side assets, such as CSS and Javascript, you first choose an asset distribution system

a) Asset-packagist & composer-merge-plugin (requires only PHP)

composer require "wikimedia/composer-merge-plugin"
composer config repositories.ap '{"type": "composer", "url": "https://asset-packagist.org"}'
composer config extra.merge-plugin.include "vendor/*/*/composer.assets.json"

b) Foxy (requires npm or yarn)

composer require "foxy/foxy:^1.0.0"

Now you are able to install the web-application base along with its dependencies

 composer require yiisoft/yii-base-web
 vendor/bin/yii serve

Now you should be able to access the application via http://localhost:8080/.

You can find more available application bases on GitHub.


Clone the repository and create the environment configuration file

cp .env.dist .env

To run the installation create a bash from the PHP image

docker-compose run --rm php bash

and run the composer commands above.

Start application stack

docker-compose up -d

Access in your browser via




Edit the file config/db.php with real data, for example:

return [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=yii2basic',
    'username' => 'root',
    'password' => '1234',
    'charset' => 'utf8',


  • Yii won't create the database for you, this has to be done manually before you can access it.
  • Check and edit the other files in the config/ directory to customize your application as required.
  • Refer to the README in the tests directory for information specific to basic application tests.


Tests are located in tests directory.

Run directly from Docker image

docker run -it -v $PWD/yii-project:/app -w /app yiisoftware/yii2-php:7.2-apache bash