PHPackages                             yiisoft/yii2-app-advanced - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. yiisoft/yii2-app-advanced

ActiveProject[Framework](/categories/framework)

yiisoft/yii2-app-advanced
=========================

Yii 2 Advanced Project Template

2.0.54(4mo ago)1.7k957.7k↑10.3%1.3k[3 issues](https://github.com/yiisoft/yii2-app-advanced/issues)[1 PRs](https://github.com/yiisoft/yii2-app-advanced/pulls)5BSD-3-ClausePHPPHP &gt;=7.4.0CI passing

Since Dec 1Pushed 1mo ago167 watchersCompare

[ Source](https://github.com/yiisoft/yii2-app-advanced)[ Packagist](https://packagist.org/packages/yiisoft/yii2-app-advanced)[ Docs](https://www.yiiframework.com/)[ Fund](https://opencollective.com/yiisoft)[ Fund](https://tidelift.com/funding/github/packagist/yiisoft/yii2-app-advanced)[ RSS](/packages/yiisoft-yii2-app-advanced/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (13)Versions (48)Used By (5)

    ![Yii Framework](https://camo.githubusercontent.com/f390171a839a7620dea19acb5fc1fb87f9226e65910c577f99803347ce48336a/68747470733a2f2f7777772e7969696672616d65776f726b2e636f6d2f696d6167652f64657369676e2f6c6f676f2f796969335f66756c6c5f666f725f6c696768742e737667)

Yii 2 Advanced Project Template
===============================

[](#yii-2-advanced-project-template)

Yii 2 Advanced Project Template is a skeleton [Yii 2](https://www.yiiframework.com/) application best for developing complex Web applications with multiple tiers.

The template includes three tiers: front end, back end, and console, each of which is a separate Yii application.

The template is designed to work in a team development environment. It supports deploying the application in different environments.

Documentation is at [docs/guide/README.md](docs/guide/README.md).

[![Latest Stable Version](https://camo.githubusercontent.com/b8462e06e98623f781eec7ee70be77328a61ee166fabd9963f3cbeb0c3163f06/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f796969736f66742f796969322d6170702d616476616e6365642e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d537461626c65266c6f676f3d7061636b6167697374)](https://packagist.org/packages/yiisoft/yii2-app-advanced)[![Total Downloads](https://camo.githubusercontent.com/2ecfe3ec54ac8e30dab246f55f13ca37cd5d5376c94cd235ba49ef5c3ceb43c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f796969736f66742f796969322d6170702d616476616e6365642e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d446f776e6c6f616473)](https://packagist.org/packages/yiisoft/yii2-app-advanced)[![build](https://camo.githubusercontent.com/e837eb924d405aaf3a23d0cea28192d7ee5027b5625a4e2873d67407b5f8aa63/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f796969736f66742f796969322d6170702d616476616e6365642f6275696c642e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d4275696c64)](https://github.com/yiisoft/yii2-app-advanced/actions?query=workflow%3Abuild)[![Static Analysis](https://camo.githubusercontent.com/6930ce3bd9f916414659a657f6b33fdc234116ad2ed7f940c5f6e4b04bcd06b7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f796969736f66742f796969322d6170702d616476616e6365642f7374617469632e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d537461746963)](https://github.com/yiisoft/yii2-app-advanced/actions/workflows/static.yml)

Docker
------

[](#docker)

[![Apache](https://camo.githubusercontent.com/2422b7b10970d1f7ba00c7471915981eb773673838ae0be704be72f34935f13b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f796969736f66742f796969322d6170702d616476616e6365642f646f636b65722e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d617061636865266c6162656c3d417061636865)](https://github.com/yiisoft/yii2-app-advanced/actions/workflows/docker.yml)

REQUIREMENTS
------------

[](#requirements)

Important

- The minimum required [PHP](https://www.php.net/) version of Yii is PHP `8.2`.

Install via Composer
--------------------

[](#install-via-composer)

If you do not have [Composer](https://getcomposer.org/), you may install it by following the instructions at [getcomposer.org](https://getcomposer.org/doc/00-intro.md#installation-nix).

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

```
composer create-project --prefer-dist yiisoft/yii2-app-advanced advanced
cd advanced
```

### Frontend

[](#frontend)

   ![Web Application Advanced - Frontend](docs/images/frontend/home-light.png)### Backend

[](#backend)

   ![Web Application Advanced - Backend](docs/images/backend/home-light.png)DIRECTORY STRUCTURE
-------------------

[](#directory-structure)

```
common
    config/              contains shared configurations
    mail/                contains view files for e-mails
    models/              contains model classes used in both backend and frontend
    tests/               contains tests for common classes
console
    config/              contains console configurations
    controllers/         contains console controllers (commands)
    migrations/          contains database migrations
    models/              contains console-specific model classes
    runtime/             contains files generated during runtime
backend
    assets/              contains application assets such as JavaScript and CSS
    config/              contains backend configurations
    controllers/         contains Web controller classes
    models/              contains backend-specific model classes
    runtime/             contains files generated during runtime
    tests/               contains tests for backend application
    views/               contains view files for the Web application
    web/                 contains the entry script and Web resources
frontend
    assets/              contains application assets such as JavaScript and CSS
    config/              contains frontend configurations
    controllers/         contains Web controller classes
    models/              contains frontend-specific model classes
    runtime/             contains files generated during runtime
    tests/               contains tests for frontend application
    views/               contains view files for the Web application
    web/                 contains the entry script and Web resources
    widgets/             contains frontend widgets
vendor/                  contains dependent 3rd-party packages
environments/            contains environment-based overrides

```

Initialize the application for the `Development` environment:

```
php init --env=Development --overwrite=All
```

Now you should be able to access the application through the following URLs, assuming `advanced` is the directory directly under the Web root.

```
http://localhost/advanced/frontend/web/
http://localhost/advanced/backend/web/

```

Install with Docker
-------------------

[](#install-with-docker)

Build and start the containers:

```
docker compose up -d --build
```

Install dependencies inside the container:

```
docker compose exec frontend composer update --prefer-dist --no-interaction
```

Initialize the application for the `Development` environment:

```
docker compose exec frontend php /app/init --env=Development --overwrite=All
```

After running `init`, update the database connection in `common/config/main-local.php` to use the `mysql`service hostname:

```
'db' => [
    'class' => \yii\db\Connection::class,
    'dsn' => 'mysql:host=mysql;dbname=yii2advanced',
    'username' => 'yii2advanced',
    'password' => 'secret',
    'charset' => 'utf8',
],
```

You can then access the application through the following URLs:

```
http://127.0.0.1:20080  (frontend)
http://127.0.0.1:21080  (backend)

```

To run the test suite, also update `common/config/test-local.php` to use the `mysql` hostname and create the test database:

```
'db' => [
    'dsn' => 'mysql:host=mysql;dbname=yii2advanced_test',
],
```

```
docker compose exec -T mysql mysql -uroot -pverysecret -e "CREATE DATABASE IF NOT EXISTS yii2advanced_test; GRANT ALL PRIVILEGES ON yii2advanced_test.* TO 'yii2advanced'@'%'; FLUSH PRIVILEGES;"
docker compose exec -T frontend php /app/yii_test migrate --interactive=0
docker compose exec -T frontend vendor/bin/codecept build
docker compose exec -T frontend vendor/bin/codecept run
```

**NOTES:**

- Minimum required Docker engine version `17.04` for development (see [Performance tuning for volume mounts](https://docs.docker.com/docker-for-mac/osxfs-caching/))
- The default configuration uses a host-volume in your home directory `~/.composer-docker/cache` for Composer caches

CONFIGURATION
-------------

[](#configuration)

Database
--------

[](#database)

Edit the file `common/config/main-local.php` with real data, for example:

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

When using Docker, the MySQL service is pre-configured. Update `common/config/main-local.php` to use:

```
'db' => [
    'class' => \yii\db\Connection::class,
    'dsn' => 'mysql:host=mysql;dbname=yii2advanced',
    'username' => 'yii2advanced',
    'password' => 'secret',
    'charset' => 'utf8',
],
```

Apply migrations:

```
php yii migrate
```

Or with Docker:

```
docker compose exec frontend php /app/yii migrate
```

**NOTES:**

- Yii won't create the database for you, this has to be done manually before you can access it. When using Docker, the MySQL service creates the database automatically.
- Check and edit the other files in the `config/` directories to customize your application as required.
- Refer to the README in the `tests` directory for information specific to application tests.

TESTING
-------

[](#testing)

Tests are located in `frontend/tests`, `backend/tests`, and `common/tests` directories. They are developed with [Codeception PHP Testing Framework](https://codeception.com/).

Tests can be executed by running:

```
vendor/bin/codecept run --env php-builtin
```

Or using the Composer script:

```
composer tests
```

Support the project
-------------------

[](#support-the-project)

[![Open Collective](https://camo.githubusercontent.com/ad8d82ae4dbf7869403317d29b3ab412509ad638d6b58d8855ec18853b5ab5ba/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4f70656e253230436f6c6c6563746976652d73706f6e736f722d3765616466313f7374796c653d666f722d7468652d6261646765266c6f676f3d6f70656e253230636f6c6c656374697665266c6f676f436f6c6f723d376561646631266c6162656c436f6c6f723d353535353535)](https://opencollective.com/yiisoft)

Follow updates
--------------

[](#follow-updates)

[![Official website](https://camo.githubusercontent.com/289983c1dde520aac09b2e2c1456588e33a6551e5353146255ef287aef12483e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f77657265645f62792d5969695f4672616d65776f726b2d677265656e2e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d796969)](https://www.yiiframework.com/)[![Follow on X](https://camo.githubusercontent.com/332c1b1e043dfb940b95825f7863dc473f6924ddacdd6738cbbbba08f49e1862/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f2d466f6c6c6f772532306f6e253230582d3144413146322e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d78266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d303030303030)](https://x.com/yiiframework)[![Telegram](https://camo.githubusercontent.com/011b161ebda90a674c45717c4bf9147979afb1ec6900246ef70ed6ba2bfc55b7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74656c656772616d2d6a6f696e2d3144413146323f7374796c653d666f722d7468652d6261646765266c6f676f3d74656c656772616d)](https://t.me/yii_framework_in_english)[![Slack](https://camo.githubusercontent.com/73a139b0b78939a369c6b99ada6184607d59e6d0c0c216d44c4012a1b3cd06ee/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736c61636b2d6a6f696e2d3144413146323f7374796c653d666f722d7468652d6261646765266c6f676f3d736c61636b)](https://yiiframework.com/go/slack)

License
-------

[](#license)

[![License](https://camo.githubusercontent.com/680c8d62ba2d5a71d7099b6e81114fb0b22d99086c121fd178e1149afc669d44/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4253442d2d332d2d436c617573652d627269676874677265656e2e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d6f70656e736f75726365696e6974696174697665266c6f676f436f6c6f723d7768697465266c6162656c436f6c6f723d353535353535)](LICENSE.md)

###  Health Score

70

—

ExcellentBetter than 100% of packages

Maintenance83

Actively maintained with recent releases

Popularity65

Solid adoption and visibility

Community48

Growing community involvement

Maturity76

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~96 days

Recently: every ~147 days

Total

47

Last Release

129d ago

PHP version history (3 changes)2.0.0-alphaPHP &gt;=5.4.0

2.0.26PHP &gt;=5.6.0

2.0.46PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/261a6249c6f605f3956a2fae40fbb813f6b2e1e6f2bf806180c851a965426e54?d=identicon)[cebe](/maintainers/cebe)

![](https://www.gravatar.com/avatar/fc29e4e7068a00fe9b9db37b8aadda1db6020adcacef810461e47b99c2b150e6?d=identicon)[samdark](/maintainers/samdark)

![](https://www.gravatar.com/avatar/23416c58e0dce33a8369451a4ca0e28666373594027debc10184b37ade6a926b?d=identicon)[qiangxue](/maintainers/qiangxue)

---

Top Contributors

[![samdark](https://avatars.githubusercontent.com/u/47294?v=4)](https://github.com/samdark "samdark (330 commits)")[![qiangxue](https://avatars.githubusercontent.com/u/993322?v=4)](https://github.com/qiangxue "qiangxue (113 commits)")[![cebe](https://avatars.githubusercontent.com/u/189796?v=4)](https://github.com/cebe "cebe (75 commits)")[![SilverFire](https://avatars.githubusercontent.com/u/4499203?v=4)](https://github.com/SilverFire "SilverFire (32 commits)")[![softark](https://avatars.githubusercontent.com/u/342857?v=4)](https://github.com/softark "softark (31 commits)")[![creocoder](https://avatars.githubusercontent.com/u/896494?v=4)](https://github.com/creocoder "creocoder (28 commits)")[![Ragazzo](https://avatars.githubusercontent.com/u/1748844?v=4)](https://github.com/Ragazzo "Ragazzo (25 commits)")[![sugiruu](https://avatars.githubusercontent.com/u/5993725?v=4)](https://github.com/sugiruu "sugiruu (13 commits)")[![githubjeka](https://avatars.githubusercontent.com/u/874234?v=4)](https://github.com/githubjeka "githubjeka (11 commits)")[![kartik-v](https://avatars.githubusercontent.com/u/3592619?v=4)](https://github.com/kartik-v "kartik-v (11 commits)")[![maximal](https://avatars.githubusercontent.com/u/980679?v=4)](https://github.com/maximal "maximal (10 commits)")[![terabytesoftw](https://avatars.githubusercontent.com/u/42547589?v=4)](https://github.com/terabytesoftw "terabytesoftw (10 commits)")[![DavertMik](https://avatars.githubusercontent.com/u/220264?v=4)](https://github.com/DavertMik "DavertMik (8 commits)")[![Arhell](https://avatars.githubusercontent.com/u/26163841?v=4)](https://github.com/Arhell "Arhell (8 commits)")[![bscheshirwork](https://avatars.githubusercontent.com/u/5769211?v=4)](https://github.com/bscheshirwork "bscheshirwork (8 commits)")[![arogachev](https://avatars.githubusercontent.com/u/8326201?v=4)](https://github.com/arogachev "arogachev (7 commits)")[![developedsoftware](https://avatars.githubusercontent.com/u/19648131?v=4)](https://github.com/developedsoftware "developedsoftware (7 commits)")[![TriAnMan](https://avatars.githubusercontent.com/u/2266882?v=4)](https://github.com/TriAnMan "TriAnMan (6 commits)")[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (6 commits)")[![DeryabinSergey](https://avatars.githubusercontent.com/u/7665884?v=4)](https://github.com/DeryabinSergey "DeryabinSergey (5 commits)")

---

Tags

hacktoberfestproject-templateyiiyii2frameworkyii2advancedproject template

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yiisoft-yii2-app-advanced/health.svg)

```
[![Health](https://phpackages.com/badges/yiisoft-yii2-app-advanced/health.svg)](https://phpackages.com/packages/yiisoft-yii2-app-advanced)
```

###  Alternatives

[izyue/yii2-app-advanced

Yii 2 Advanced Project Template

1281.9k](/packages/izyue-yii2-app-advanced)[beaten-sect0r/yii2-core

Yii2 Core project template

771.1k](/packages/beaten-sect0r-yii2-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
