在從官網下載 Composer-Setup.exe安裝程序後,在安裝過程中會碰到幾個麻煩的地方:
1. 找不到擴展dll文件,修改php.ini文件內extension_dir 參數
2. browscap未找到,修改php.ini文件內 browscap參數
3. SSL dll未找到,修改php.ini文件內";extension=php_openssl.dll",去掉前面“;”
正確的安裝畫面,如下:
2使用Composer中文鏡像網站,替代國外網站
當妳安裝完Composer後,使用時,缺發現不能下載包,這是壹個眾所周知的原因。
所以,我們要什麽國內的鏡像站點進行代替,常用方法有兩種:
1. 修改全局配置:全局配置的文件壹般放在C:\Users\XXX\AppData\Roaming\Composer\config.json;
{ "config": { }, "repositories": [ {"type":"composer", "url":"poser.com/repo/packagist/"}, {"packagist":false} ] }
2. 修改當前配置:即項目當前的composer.json文件;
以 laravel 項目的 composer.json 配置文件為例:
{ "name": "laravel/laravel", "description": "TheLaravel Framework.", "keywords": ["framework", "laravel"], "license":"MIT", "type": "project", "require": { "laravel/framework":"4.2.*" }, "autoload": { "classmap": [ "app/commands", "app/controllers", "app/models", "app/database/migrations", "app/database/seeds", "app/tests/TestCase.php" ] }, "scripts": { "post-install-cmd":[ "php artisanclear-compiled", "php artisan optimize" ], "post-update-cmd":[ "php artisanclear-compiled", "php artisan optimize" ], "post-create-project-cmd":[ "php artisankey:generate" ] }, "config": { "preferred-install":"dist" }, "minimum-stability":"stable", "repositories": [ {"type":"composer", "url":"poser.com/repo/packagist/"}, {"packagist": false} ] }