安装:
step1. 安装composer
$curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer
Downloading 1.0.1...
Composer successfully installed to: /home/hanying/nginx/composer.phar
Use it: php composer.phar
$mv composer.phar /usr/local/bin/composer
step2. 安装yii
【在web服务器可访问的文件夹下】
$sudo composer global require "fxp/composer-asset-plugin:~1.1.1"
Changed current directory to /home/hanying/.composer
Running composer as root/super user is highly discouraged as packages, plugins and scripts cannot always be trusted
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing fxp/composer-asset-plugin (v1.1.3)
Downloading: 100%
Writing lock file
Generating autoload files
$sudo composer create-project --prefer-dist yiisoft/yii2-app-basic basic
安装过程中需生成github生成token:
https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+master+2016-04-21+1037
进入yii目录,目录名位basic
执行
$php yii serve