linux composer 安装与应用
linux下composer安装与简单应用
-------------------------------------安装------------------------------------
//下载composer
curl -sS https://getcomposer.org/installer | php
//将composer.phar文件移动到bin目录以便全局使用composer命令
mv composer.phar /usr/local/bin/composer
//切换国内源
composer config -g repo.packagist composer https://packagist.phpcomposer.com
------------------------------------简单应用----------------------------------
//安装thinkphp5
composer create-project topthink/think whatever_you_like_name --prefer-dist
//更新项目
切换到项目文件夹中(与composer.json文件同级目录)
composer update
//安装拓展 (dependency manager for PHP)
例如,安装支付宝 微信集成接口
composer require riverslei/payment
执行完了就安装了,查看composer.json文件,require部分多了 "riverslei/payment": "~2.0"
安装位置一般在项目扩展文件夹,如:TP5中的vendor.
-------------------------------------------------------------------------------
=========更新==================2018-10-18======================
ubuntu 安装
sudo apt install composer
最近出现 composer 应用出现 需要用户和密码
更换源
composer config -g repo.packagist composer https://packagist.laravel-china.org
注意 composer.json 中 repositories url 也要改