感觉现在记忆越来越差
都得记下来
在线安装
在线安装最好是在服务器上面进行,因为
Guib 对中国好像屏蔽了。有些东西下载不下来,或者很慢
官方给的2中方式,第一种我本地不行,用的第二种方法
curl -sS https://getcomposer.org/installer | php
php -r "readfile('https://getcomposer.org/installer');" | php
第二种安装也是费了很大的劲,因为我的php.ini里面有点问题
安装完成:
[root@grande advanced]# php -r "readfile('https://getcomposer.org/installer');" | php
#!/usr/bin/env php
All settings correct for using Composer
Downloading...
Composer successfully installed to: /www/web/develop/advanced/composer.phar
Use it: php composer.phar
[root@grande advanced]# ls
多了一个composer.phar的文件。
然后
install the Composer Asset Plugin:
php composer.phar global require "fxp/composer-asset-plugin:1.0.0-beta3"完成后:
然后安装基本模板的yii:
php composer.phar create-project yiisoft/yii2-app-basic basic 2.0.0
安装高级模板yii:
php composer.phar create-project yiisoft/yii2-app-advanced advanced 2.0.0
在安装的时候会报错,
Could not fetch https://api.github.com/repos/RobinHerbots/jquery.inputmask/contents/bower.json?ref=dffa7d6dcb9f279b6df93407f7a76f7044528933, enter your GitHub credentials to go over the API rate limit
The credentials will be swapped for an OAuth token stored in /root/.composer/auth.json, your password will not be stored
To revoke access to this token you can visit https://github.com/settings/applications
这需要您到GitHub注册一个账户 https://github.com/
Username: zqy234
Password:
成功后就可以继续进行更新
安装插件:
composer.phar复制到yii 的根目录下,打开文件composer.json
如果安装redis库包,那么 添加 "yiisoft/yii2-redis": "*",如下:
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*",
"yiisoft/yii2-redis": "*"
},
安装mongodb库包:
"yiisoft/yii2-mongodb": "*"
然后执行:
php composer.phar update
就可以了。
然后执行
./init
,这些就不需要svn同步了。
Which environment do you want the application to be initialized in?
[0] Development
[1] Production
Your choice [0-1, or "q" to quit] 0
Initialize the application under 'Development' environment? [yes|no] yes
Start initialization ...
generate console/config/main-local.php
generate console/config/params-local.php
generate common/config/main-local.php
generate common/config/params-local.php
generate yii
generate backend/config/main-local.php
generate backend/config/params-local.php
generate backend/web/index.php
generate backend/web/index-test.php
generate frontend/config/main-local.php
generate frontend/config/params-local.php
generate frontend/web/index.php
generate frontend/web/index-test.php
generate cookie validation key in backend/config/main-local.php
generate cookie validation key in frontend/config/main-local.php
chmod 0777 backend/runtime
chmod 0777 backend/web/assets
chmod 0777 frontend/runtime
chmod 0777 frontend/web/assets
chmod 0755 yii
... initialization completed.