README.md 2.57 KB
Newer Older
1 2
Yii 2 Basic Application Template
================================
3

Qiang Xue committed
4
Yii 2 Basic Application Template is a skeleton Yii 2 application best for
5
rapidly creating small projects.
6

Qiang Xue committed
7 8 9
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.
10 11 12 13 14


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

15
      assets/             contains assets definition
16 17 18
      commands/           contains console commands (controllers)
      config/             contains application configurations
      controllers/        contains Web controller classes
19
      mail/               contains view files for e-mails
20 21
      models/             contains model classes
      runtime/            contains files generated during runtime
22
      tests/              contains various tests for the basic application
23 24
      vendor/             contains dependent 3rd-party packages
      views/              contains view files for the Web application
25
      web/                contains the entry script and Web resources
26 27 28 29 30 31



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

Qiang Xue committed
32
The minimum requirement by this application template that your Web server supports PHP 5.4.0.
33 34 35 36 37


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

Qiang Xue committed
38
### Install from an Archive File
39

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

Qiang Xue committed
43
You can then access the application through the following URL:
44 45

~~~
Qiang Xue committed
46
http://localhost/basic/web/
47 48 49
~~~


Qiang Xue committed
50
### Install via Composer
51

Qiang Xue committed
52 53
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).
Tobias Munk committed
54

Qiang Xue committed
55
You can then install this application template using the following command:
Tobias Munk committed
56

Qiang Xue committed
57
~~~
58
php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
Qiang Xue committed
59
~~~
Tobias Munk committed
60

Qiang Xue committed
61 62
Now you should be able to access the application through the following URL, assuming `basic` is the directory
directly under the Web root.
Tobias Munk committed
63 64

~~~
Qiang Xue committed
65
http://localhost/basic/web/
Tobias Munk committed
66 67
~~~

68 69 70 71 72 73 74 75 76 77

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

### Database

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

```php
return [
78 79 80 81 82
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=yii2basic',
    'username' => 'root',
    'password' => '1234',
    'charset' => 'utf8',
83 84 85 86 87 88
];
```

**NOTE:** Yii won't create the database for you, this has to be done manually before you can access it.

Also check and edit the other files in the `config/` directory to customize your application.