Press "Enter" to skip to content

[Laravel]Install Composer

1. 下載最新版本的composer套件

php -r "copy('https://getcomposer.org/installer','composer-setup.php');"

2. 檢查檔案完整性

php -r "if (hash_file('SHA384', 'composer-setup.php') ==='e115a8dc7871f15d853148a7fbac7d

a27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae'){ echo 'Installer verified'; } else { echo 'Ins

taller corrupt'; unlink('composer-setup.php'); } echoPHP_EOL;"

3. 運行安裝文件

php composer-setup.php

4. 刪除安裝文件

php -r "unlink('composer-setup.php');"

在完裝完成之後 , 根目錄會多出 composer.phar

新增 dependency

在 composer.json 加入要新增的 dependency路徑 例如:

"require": {

"php": ">=5.5.9",

"laravel/framework": "5.2.*",

"paypal/adaptivepayments-sdk-php":"v3.6.106"

}

然後在terminal中運行 php composer.phar install

更新composer.json中所有的dependency

直接在terminal中輸入 php composer.phar update

Comments