一、安装


composer global require "fxp/composer-asset-plugin:1.0.0-beta4"


二、安装应用程序模板

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

安装过程中,由于超出github限额,以前提示输入github账号和密码;

现在改为输入Token,按提示打开它的网址:

​https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+PC201412132247+2015-05-08+1725​

Create Token后,输入命令行的Token(Hidden)后面,回车。

下载完成后,

访问:http://localhost/basic/web/index.php 显示界面,安装成功。

其它:

检查Yii基本环境需求:

​http://localhost/basic/requirements.php​

生产环境中,要设置文档根目录并设置UrlRewrite:

<VirtualHost *:8080>
ServerAdmin webmaster@dummy-host2.example.com
DocumentRoot "C:/xampp/htdocs/test/basic/web"
ServerName test.com
ErrorLog "logs/test.com-error.log"
CustomLog "logs/dummy-test.com-access.log" common

<Directory "C:/xampp/htdocs/test/basic/web">
RewriteEngine on
# 如果请求的是真实存在的文件或目录,直接访问
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# 如果请求的不是真实文件或目录,分发请求至 index.php
RewriteRule . index.php
</Directory>

</VirtualHost>