安装Composer:
#安装到当前目录,使用命令php composer.phar
curl -sS https://getcomposer.org/installer | php
#也可移动到PATH目录,使用命令composer
mv composer.phar /usr/local/bin/composer
#安装到指定目录
#curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
或直接下载执行文件:
https://getcomposer.org/composer-stable.phar -O /usr/local/bin/composer
chmod +x /usr/local/bin/composer
Composer配置文件:
cat composer.json
{
"require": {
"tedivm/fetch": "0.6.*"
}
}
Composer安装及更新包:
#安装,在配置文件目录执行,软件会下载安装到vendor目录
composer install
#更新
composer update
#命令方式安装指定包,同时会写入配置文件
composer require tedivm/fetch:0.6.*
#更新指定包
composer update tedivm/fetch
PHP调用Composer安装的包:
require 'vendor/autoload.php';
标签:none