|
|
@ -1,15 +1,30 @@ |
|
|
|
Bootstrap with Yii |
|
|
|
Bootstrap with Yii |
|
|
|
================== |
|
|
|
================== |
|
|
|
|
|
|
|
|
|
|
|
A ready-to-use Web application is distributed together with Yii. You may find |
|
|
|
Yii provides a few read-to-use application templates. Based on your needs, you may |
|
|
|
its source code under the `app` folder after you expand the Yii release file. |
|
|
|
choose one of them to bootstrap your project. |
|
|
|
If you have installed Yii under a Web-accessible folder, you should be able to |
|
|
|
|
|
|
|
access this application through the following URL: |
|
|
|
In following, we describe how to get started with the "Yii 2 Basic Application Template". |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### Install via Composer |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If you do not have [Composer](http://getcomposer.org/), you may download it from |
|
|
|
|
|
|
|
[http://getcomposer.org/](http://getcomposer.org/) or run the following command on Linux/Unix/MacOS: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
~~~ |
|
|
|
|
|
|
|
curl -s http://getcomposer.org/installer | php |
|
|
|
|
|
|
|
~~~ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You can then install the Bootstrap Application using the following command: |
|
|
|
|
|
|
|
|
|
|
|
~~~ |
|
|
|
~~~ |
|
|
|
http://localhost/yii/apps/bootstrap/index.php |
|
|
|
php composer.phar create-project --stability=dev yiisoft/yii2-app-basic yii-basic |
|
|
|
~~~ |
|
|
|
~~~ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Now you should be able to access the Bootstrap Application using the URL `http://localhost/yii-basic/www/`, |
|
|
|
|
|
|
|
assuming `yii-basic` is directly under the document root of your Web server. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
As you can see, the application has four pages: the homepage, the about page, |
|
|
|
As you can see, the application has four pages: the homepage, the about page, |
|
|
|
the contact page and the login page. The contact page displays a contact |
|
|
|
the contact page and the login page. The contact page displays a contact |
|
|
@ -20,29 +35,17 @@ and the login page allows users to be authenticated before accessing privileged |
|
|
|
The following diagram shows the directory structure of this application. |
|
|
|
The following diagram shows the directory structure of this application. |
|
|
|
|
|
|
|
|
|
|
|
~~~ |
|
|
|
~~~ |
|
|
|
app/ |
|
|
|
yii-basic/ |
|
|
|
index.php Web application entry script file |
|
|
|
|
|
|
|
index-test.php entry script file for the functional tests |
|
|
|
|
|
|
|
assets/ containing published resource files |
|
|
|
|
|
|
|
css/ containing CSS files |
|
|
|
|
|
|
|
img/ containing image files |
|
|
|
|
|
|
|
themes/ containing application themes |
|
|
|
|
|
|
|
protected/ containing protected application files |
|
|
|
|
|
|
|
yii yii command line script for Unix/Linux |
|
|
|
yii yii command line script for Unix/Linux |
|
|
|
yii.bat yii command line script for Windows |
|
|
|
yii.bat yii command line script for Windows |
|
|
|
|
|
|
|
requirements.php the requirement checker script |
|
|
|
commands/ containing customized yii console commands |
|
|
|
commands/ containing customized yii console commands |
|
|
|
components/ containing reusable user components |
|
|
|
|
|
|
|
config/ containing configuration files |
|
|
|
config/ containing configuration files |
|
|
|
console.php the console application configuration |
|
|
|
console.php the console application configuration |
|
|
|
main.php the Web application configuration |
|
|
|
main.php the Web application configuration |
|
|
|
controllers/ containing controller class files |
|
|
|
controllers/ containing controller class files |
|
|
|
SiteController.php the default controller class |
|
|
|
SiteController.php the default controller class |
|
|
|
data/ containing the sample database |
|
|
|
|
|
|
|
schema.mysql.sql the DB schema for the sample MySQL database |
|
|
|
|
|
|
|
schema.sqlite.sql the DB schema for the sample SQLite database |
|
|
|
|
|
|
|
bootstrap.db the sample SQLite database file |
|
|
|
|
|
|
|
vendor/ containing third-party extensions and libraries |
|
|
|
vendor/ containing third-party extensions and libraries |
|
|
|
messages/ containing translated messages |
|
|
|
|
|
|
|
models/ containing model class files |
|
|
|
models/ containing model class files |
|
|
|
User.php the User model |
|
|
|
User.php the User model |
|
|
|
LoginForm.php the form model for 'login' action |
|
|
|
LoginForm.php the form model for 'login' action |
|
|
@ -56,6 +59,10 @@ app/ |
|
|
|
contact.php the view for the 'contact' action |
|
|
|
contact.php the view for the 'contact' action |
|
|
|
index.php the view for the 'index' action |
|
|
|
index.php the view for the 'index' action |
|
|
|
login.php the view for the 'login' action |
|
|
|
login.php the view for the 'login' action |
|
|
|
|
|
|
|
www/ containing Web-accessible resources |
|
|
|
|
|
|
|
index.php Web application entry script file |
|
|
|
|
|
|
|
assets/ containing published resource files |
|
|
|
|
|
|
|
css/ containing CSS files |
|
|
|
~~~ |
|
|
|
~~~ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|