PHPackages                             yiisoft/yii2-app-basic - 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-basic

ActiveProject[Framework](/categories/framework)

yiisoft/yii2-app-basic
======================

Yii 2 Basic Project Template

2.0.55(1mo ago)7101.8M—9.1%784[1 PRs](https://github.com/yiisoft/yii2-app-basic/pulls)8BSD-3-ClausePHPPHP &gt;=8.2CI passing

Since Dec 1Pushed 1w ago71 watchersCompare

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

READMEChangelogDependencies (29)Versions (53)Used By (8)

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

Yii 2 Basic Project Template
============================

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

Yii 2 Basic Project Template is a skeleton [Yii 2](https://www.yiiframework.com/) application best for rapidly creating small 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](https://camo.githubusercontent.com/f4d4e65726f6f983ab3c42c0799c3dfe6bd7ca4c59560aaca46f739bd1aa958a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f796969736f66742f796969322d6170702d62617369632e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d537461626c65266c6f676f3d7061636b6167697374)](https://packagist.org/packages/yiisoft/yii2-app-basic)[![Total Downloads](https://camo.githubusercontent.com/68222fa9f5c8673cfab9d440f551e0707a555fc750ef870303984e73fa5f4ed0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f796969736f66742f796969322d6170702d62617369632e7376673f7374796c653d666f722d7468652d6261646765266c6162656c3d446f776e6c6f616473)](https://packagist.org/packages/yiisoft/yii2-app-basic)[![build](https://camo.githubusercontent.com/0aaeb167516434e514ec251ee239440f26185ce71e033972edf194ce193ae475/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f796969736f66742f796969322d6170702d62617369632f6275696c642e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d676974687562266c6162656c3d4275696c64)](https://github.com/yiisoft/yii2-app-basic/actions?query=workflow%3Abuild)[![codecov](https://camo.githubusercontent.com/4db3d7afb291b36ad7f55b6df0709ec69085dbf51d7c2e0b16aa20470d63c2d5/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f796969736f66742f796969322d6170702d62617369632e7376673f7374796c653d666f722d7468652d6261646765266c6f676f3d636f6465636f76266c6f676f436f6c6f723d7768697465266c6162656c3d436f6465636f76)](https://codecov.io/gh/yiisoft/yii2-app-basic)[![Static Analysis](https://camo.githubusercontent.com/cd9e9abda001a654aa6fc9b117cb4f977aaffda1302567e159adaa0b608b98c5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f796969736f66742f796969322d6170702d62617369632f7374617469632e796d6c3f7374796c653d666f722d7468652d6261646765266c6162656c3d537461746963)](https://github.com/yiisoft/yii2-app-basic/actions/workflows/static.yml)

   ![Web Application Basic](docs/images/home-light.png)Docker
------

[](#docker)

[![Apache](https://camo.githubusercontent.com/059e6e1680206e3ed2696d481a89b07dccb39185fd95bd58b432b4d4fac357bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f796969736f66742f796969322d6170702d62617369632f646f636b65722e796d6c3f7374796c653d666f722d7468652d6261646765266c6f676f3d617061636865266c6162656c3d417061636865)](https://github.com/yiisoft/yii2-app-basic/actions/workflows/docker.yml)

DIRECTORY STRUCTURE
-------------------

[](#directory-structure)

```
  assets/             contains assets definition
  commands/           contains console commands (controllers)
  config/             contains application configurations
  controllers/        contains Web controller classes
  mail/               contains view files for e-mails
  models/             contains model classes
  runtime/            contains files generated during runtime
  tests/              contains various tests for the basic application
  vendor/             contains dependent 3rd-party packages
  views/              contains view files for the Web application
  web/                contains the entry script and Web resources

```

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

[](#requirements)

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

INSTALLATION
------------

[](#installation)

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 command:

```
composer create-project --prefer-dist yiisoft/yii2-app-basic basic

```

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

```
http://localhost/basic/web/

```

Install from an Archive File
----------------------------

[](#install-from-an-archive-file)

Extract the archive file downloaded from [yiiframework.com](https://www.yiiframework.com/download/) to a directory named `basic` that is directly under the Web root.

Set cookie validation key in `config/web.php` file to some random secret string:

```
'request' => [
    // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
    'cookieValidationKey' => '',
],
```

You can then access the application through the following URL:

```
http://localhost/basic/web/

```

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

[](#install-with-docker)

Update your vendor packages

```
docker-compose run --rm php composer update --prefer-dist

```

Run the installation triggers (creating cookie validation code)

```
docker-compose run --rm php composer install

```

Start the container

```
docker-compose up -d

```

You can then access the application through the following URL:

```
http://127.0.0.1:8000

```

Run tests inside the container

```
docker compose exec -T php vendor/bin/codecept build
docker compose exec -T php 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 `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',
];
```

**NOTES:**

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

TESTING
-------

[](#testing)

Tests are located in `tests` directory. They are developed with [Codeception PHP Testing Framework](https://codeception.com/). By default, there are 3 test suites:

- `unit`
- `functional`
- `acceptance`

Tests can be executed by running

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

```

The command above will execute unit and functional tests. Unit tests are testing the system components, while functional tests are for testing user interaction.

Acceptance tests
----------------

[](#acceptance-tests)

The `acceptance` suite is configured in `tests/Acceptance.suite.yml`.

### Acceptance tests (PhpBrowser)

[](#acceptance-tests-phpbrowser)

By default, acceptance tests use the `PhpBrowser` module and run against the built-in PHP web server started via the `php-builtin` environment.

```
# run all tests with built-in web server
composer tests

# run acceptance tests only
vendor/bin/codecept run Acceptance --env php-builtin

```

### Acceptance tests (WebDriver + Selenium)

[](#acceptance-tests-webdriver--selenium)

To run acceptance tests in a real browser, switch the `acceptance` suite to use the `WebDriver` module. `tests/Acceptance.suite.yml` contains an example WebDriver configuration (commented).

1. Download and start [Selenium Server](https://www.selenium.dev/downloads/).
2. Install the corresponding browser driver (for example. [GeckoDriver](https://github.com/mozilla/geckodriver/releases) or [ChromeDriver](https://googlechromelabs.github.io/chrome-for-testing/)).
3. Update `tests/Acceptance.suite.yml` to enable `WebDriver` and disable `PhpBrowser`.
4. Run:

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

```

Code coverage support
---------------------

[](#code-coverage-support)

Code coverage is configured in `codeception.yml`. You can run your tests and collect coverage with the following command:

```
#collect coverage for all tests
vendor/bin/codecept run --coverage --coverage-html --coverage-xml --env php-builtin

#collect coverage only for unit tests
vendor/bin/codecept run Unit --coverage --coverage-html --coverage-xml --env php-builtin

#collect coverage for unit and functional tests
vendor/bin/codecept run Functional,Unit --coverage --coverage-html --coverage-xml --env php-builtin

```

You can see code coverage output under the `tests/Support/output` directory.

Documentation
-------------

[](#documentation)

- [Internals](docs/internals.md)

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

77

—

ExcellentBetter than 100% of packages

Maintenance94

Actively maintained with recent releases

Popularity65

Solid adoption and visibility

Community47

Growing community involvement

Maturity89

Battle-tested with a long release history

 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 ~94 days

Recently: every ~112 days

Total

49

Last Release

55d ago

Major Versions

2.0.54 → 22.x-dev2026-04-13

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

2.0.32PHP &gt;=5.6.0

2.0.46PHP &gt;=7.4.0

22.x-devPHP &gt;=8.3

2.0.55PHP &gt;=8.2

### 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 (188 commits)")[![qiangxue](https://avatars.githubusercontent.com/u/993322?v=4)](https://github.com/qiangxue "qiangxue (147 commits)")[![cebe](https://avatars.githubusercontent.com/u/189796?v=4)](https://github.com/cebe "cebe (80 commits)")[![Ragazzo](https://avatars.githubusercontent.com/u/1748844?v=4)](https://github.com/Ragazzo "Ragazzo (36 commits)")[![SilverFire](https://avatars.githubusercontent.com/u/4499203?v=4)](https://github.com/SilverFire "SilverFire (19 commits)")[![maximal](https://avatars.githubusercontent.com/u/980679?v=4)](https://github.com/maximal "maximal (17 commits)")[![terabytesoftw](https://avatars.githubusercontent.com/u/42547589?v=4)](https://github.com/terabytesoftw "terabytesoftw (16 commits)")[![DavertMik](https://avatars.githubusercontent.com/u/220264?v=4)](https://github.com/DavertMik "DavertMik (13 commits)")[![schmunk42](https://avatars.githubusercontent.com/u/649031?v=4)](https://github.com/schmunk42 "schmunk42 (9 commits)")[![Arhell](https://avatars.githubusercontent.com/u/26163841?v=4)](https://github.com/Arhell "Arhell (8 commits)")[![HA3IK](https://avatars.githubusercontent.com/u/3060791?v=4)](https://github.com/HA3IK "HA3IK (7 commits)")[![creocoder](https://avatars.githubusercontent.com/u/896494?v=4)](https://github.com/creocoder "creocoder (7 commits)")[![lucianobaraglia](https://avatars.githubusercontent.com/u/374554?v=4)](https://github.com/lucianobaraglia "lucianobaraglia (6 commits)")[![developedsoftware](https://avatars.githubusercontent.com/u/19648131?v=4)](https://github.com/developedsoftware "developedsoftware (6 commits)")[![githubjeka](https://avatars.githubusercontent.com/u/874234?v=4)](https://github.com/githubjeka "githubjeka (6 commits)")[![damasco](https://avatars.githubusercontent.com/u/1377554?v=4)](https://github.com/damasco "damasco (5 commits)")[![ricpelo](https://avatars.githubusercontent.com/u/616169?v=4)](https://github.com/ricpelo "ricpelo (5 commits)")[![pana1990](https://avatars.githubusercontent.com/u/6630197?v=4)](https://github.com/pana1990 "pana1990 (4 commits)")[![slavcodev](https://avatars.githubusercontent.com/u/757721?v=4)](https://github.com/slavcodev "slavcodev (4 commits)")[![WinterSilence](https://avatars.githubusercontent.com/u/3521094?v=4)](https://github.com/WinterSilence "WinterSilence (3 commits)")

---

Tags

hacktoberfestproject-templateyiiyii2frameworkyii2project templatebasic

###  Code Quality

TestsCodeception

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[yiisoft/yii2-app-advanced

Yii 2 Advanced Project Template

1.7k961.7k5](/packages/yiisoft-yii2-app-advanced)

PHPackages © 2026

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