README.md 3.27 KB
Newer Older
1 2 3
Yii 2 Advanced Application Template
===================================

Qiang Xue committed
4 5
Yii 2 Advanced Application Template is a skeleton Yii 2 application best for
developing complex Web applications with multiple tiers.
6

Qiang Xue committed
7 8
The template includes three tiers: front end, back end, and console, each of which
is a separate Yii application.
9

Qiang Xue committed
10 11
The template is designed to work in a team development environment. It supports
deploying the application in different environments.
12 13 14 15 16 17 18 19


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

```
common
	config/             contains shared configurations
20
	models/             contains model classes used in both backend and frontend
21 22 23 24 25 26
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
27
backend
28
	assets/             contains application assets such as JavaScript and CSS
29
	config/             contains backend configurations
30
	controllers/        contains Web controller classes
31
	models/             contains backend-specific model classes
32 33
	runtime/            contains files generated during runtime
	views/              contains view files for the Web application
34
	web/                contains the entry script and Web resources
35 36 37 38 39 40 41
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
	views/              contains view files for the Web application
42
	web/                contains the entry script and Web resources
43
vendor/                 contains dependent 3rd-party packages
44
environments/                contains environment-based overrides
45 46 47 48 49 50
```


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

Qiang Xue committed
51
The minimum requirement by this application template that your Web server supports PHP 5.4.0.
52 53 54 55 56


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

Qiang Xue committed
57
### Install from an Archive File
58

Qiang Xue committed
59 60
Extract the archive file downloaded from [yiiframework.com](http://www.yiiframework.com/download/) to
a directory named `advanced` that is directly under the Web root.
61

Qiang Xue committed
62 63 64 65 66 67 68
Then follow the instructions given in "GETTING STARTED".


### Install via Composer

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

Qiang Xue committed
70
You can then install the application using the following command:
71 72

~~~
73
php composer.phar create-project --stability=dev yiisoft/yii2-app-advanced advanced
74 75
~~~

Tobias Munk committed
76

77 78 79
GETTING STARTED
---------------

Qiang Xue committed
80 81
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.
82

Qiang Xue committed
83 84 85
1. Run command `init` to initialize the application with a specific environment.
2. Create a new database and adjust the `components.db` configuration in `common/config/params.php` accordingly.
3. Run command `yii migrate` to apply DB migrations.
Qiang Xue committed
86 87 88

Now you should be able to access:

Qiang Xue committed
89 90
- the frontend using the URL `http://localhost/advanced/frontend/web/`
- the backend using the URL `http://localhost/advanced/backend/web/`