下载composer
curl -s http://getcomposer.org/installer | php
composer路径添加到path
mvim ~/.profile
export PATH=/Applications/MAMP/bin/php/php5.6.2/bin:~/php:$PATH
composer默认太慢,添加中国镜像,mvim ~/.composer/config.json
{ "repositories": [ {"type": "composer", "url": "http://pkg.phpcomposer.com/repo/packagist/"}, {"packagist": false} ] }
安装yii2
composer global require "fxp/composer-asset-plugin:1.0.0" composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-advanced 你的项目路径
basic和advance项目的命令分别为
yiisoft/yii2-app-advanced yiisoft/yii2-app-basic
cd xxx,./init
如果没有第一行composer命令,则yii2项目运行的时候会报addRules的错误
话说,下载真心好慢
时间: 2024-10-24 16:31:21