PHPackages                             yii2mod/base - 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. yii2mod/base

ActiveProject[Framework](/categories/framework)

yii2mod/base
============

Base application template for Yii2

2.5(7y ago)531.3k14MITPHPPHP &gt;=7.0.0

Since Nov 2Pushed 6y ago7 watchersCompare

[ Source](https://github.com/yii2mod/base)[ Packagist](https://packagist.org/packages/yii2mod/base)[ Docs](https://github.com/yii2mod/base/)[ RSS](/packages/yii2mod-base/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (21)Versions (32)Used By (0)

 [ ![](https://avatars0.githubusercontent.com/u/993323) ](https://github.com/yiisoft)

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

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

Yii 2 Basic Application Template is a skeleton Yii 2 application best for rapidly creating small projects.

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/3473a94847ed187a2dea90ebcdbd98b433bbb7e71a27bf8791a98f6b71f8e7f8/68747470733a2f2f706f7365722e707567782e6f72672f796969326d6f642f626173652f762f737461626c65)](https://packagist.org/packages/yii2mod/base)[![Total Downloads](https://camo.githubusercontent.com/46f9307d14ed66370d9ff8a01bcb17edd67e2a06ca237cce7f871b54a708f8bc/68747470733a2f2f706f7365722e707567782e6f72672f796969326d6f642f626173652f646f776e6c6f616473)](https://packagist.org/packages/yii2mod/base)[![License](https://camo.githubusercontent.com/587fe439df70845a7b9f70f80d959a1862a1e1c5d9b9c97fe545ed3ec90b206c/68747470733a2f2f706f7365722e707567782e6f72672f796969326d6f642f626173652f6c6963656e7365)](https://packagist.org/packages/yii2mod/base)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/3619a45695418de148484c067f41b513f2dbcc7cb7fc644ec9bb60967d268c91/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f796969326d6f642f626173652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/yii2mod/base/?branch=master)[![Build Status](https://camo.githubusercontent.com/3d84bc71359a8d8bbac226350f5b5ffb6c40feb38be63a5815917da388b35864/68747470733a2f2f7472617669732d63692e6f72672f796969326d6f642f626173652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/yii2mod/base)

Support us
----------

[](#support-us)

Does your business depend on our contributions? Reach out and support us on [Patreon](https://www.patreon.com/yii2mod). All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.

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

```

FEATURES
--------

[](#features)

- [Sign in, Sign up, Forgot Password, etc.](https://github.com/yii2mod/yii2-user)
- User management
- [RBAC with predefined `guest`, `user` and `admin` roles](https://github.com/yii2mod/yii2-rbac)
- Content management components: [cms](https://github.com/yii2mod/yii2-cms), [comments](https://github.com/yii2mod/yii2-comments)
- [Yii2 component for logging cron jobs](https://github.com/yii2mod/yii2-cron-log)
- Account page
- [Key-value storage component](https://github.com/yii2mod/yii2-settings)
- [Scheduling extension for running cron jobs](https://github.com/yii2mod/yii2-scheduling)
- [Support multipath migrations](https://github.com/yii2mod/base/blob/master/config/console.php#L10)
- [Support Docker](https://github.com/yii2mod/base#installing-using-docker)
- [Included PHP Coding Standards Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer)
- Support environments (dev, prod)

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

[](#requirements)

The minimum requirement by this application template that your Web server supports PHP 5.6

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

[](#installation)

Installing using Composer
-------------------------

[](#installing-using-composer)

If you do not have [Composer](http://getcomposer.org/), follow the instructions in the [Installing Yii](https://github.com/yiisoft/yii2/blob/master/docs/guide/start-installation.md#installing-via-composer) section of the definitive guide to install it.

With Composer installed, you can then install the application using the following commands:

```
composer create-project --prefer-dist --stability=dev yii2mod/base application

```

The first command installs the [composer asset plugin](https://github.com/francoispluchino/composer-asset-plugin/)which allows managing bower and npm package dependencies through Composer. You only need to run this command once for all. The second command installs the yii2mod/base application in a directory named `application`. You can choose a different directory name if you want.

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

[](#configuration)

After you install the application, you have to conduct the following steps to initialize the installed application. You only need to do these once for all.

1. Init the application by the following command:

```
./init --env=Development
```

2. Create a new database and adjust the `components['db']` configuration in `config/common-local.php` accordingly.
3. Apply migrations:

- `php yii migrate` - create default tables for application
- `php yii rbac/migrate` - create roles, permissions and rules
- `php yii fixture "*"` - load fixtures (cms pages and users)

4. Set document root of your web server to `/path/to/application/web/` folder.

Installing using Docker
-----------------------

[](#installing-using-docker)

> You need to have [docker](http://www.docker.com) (1.10.0+) and [docker-compose](https://docs.docker.com/compose/install/) (1.6.0+) installed.

You can install the application using the following commands:

```
composer create-project --no-install --stability=dev yii2mod/base yii2mod-base
cd yii2mod-base
./init --env=Development
cp .env{.dist,} && cp docker-compose.override.yml{.dist,}
docker-compose up -d --build
```

> In `.env` file your need to set your UID. You can get your UID by the following command in the terminal: `id -u `

It may take some minutes to download the required docker images. When done, you need to install vendors as follows:

```
docker-compose exec web bash
composer install
chown -R www-data:www-data runtime web/assets vendor
```

After this steps, you need to update `db` section in the `common-local.php` file as follows:

```
