以下是php composer 安裝,替自己做點筆記
cd /your-project curl -s https://getcomposer.org/installer | php
這時在你安裝的目錄下會產生一個composer.phar檔 , 為了能讓全域使用,執行以下
sudo mv composer.phar /usr/local/bin/composer
然後在專案目錄下新增一個composer.json檔,以下以aws-sdk為範例
{ "require": { "aws/aws-sdk-php": "2.*" } } composer install
跑了上述composer install後會產生vender目錄,之後只要在你的程式碼加入以下即可
1
2
3
|
<?php require_once "vendors/autoloader.php" ; // your code here |
相關連結:
1.https://speakerdeck.com/jaceju/begining-composer
2.http://blog.longwin.com.tw/2013/05/php-composer-package-library-2013/
3.http://www.sitepoint.com/php-dependency-management-with-composer/
4.http://getcomposer.org/doc/03-cli.md
5. http://getcomposer.org/doc/00-intro.md