php composer 常用命令
2020-12-25 17:27
标签:getc nginx -- clu 版本 discard http tac require composer config -l 取消配置: 项目配置 取消配置: composer require phpoffice/phpspreadsheet 1.15 官网下载 更新composer 经常执行 composer 命令增加 -vvv 可输出详细的信息,命令如下: php composer 常用命令 标签:getc nginx -- clu 版本 discard http tac require 原文地址:https://blog.51cto.com/6720116/2546878注意在工程目录下面执行(composer.json 所在的文件夹)
1、查看composer配置
composer config -l
[repositories.packagist.org.type] composer
[repositories.packagist.org.url] https://mirrors.aliyun.com/composer/
[process-timeout] 300
[use-include-path] false
[preferred-install] auto
[notify-on-install] true
[github-protocols] [https, ssh]
[vendor-dir] ../LieBitComposer (/huayong/app/php/liebite/../LieBitComposer)
[bin-dir] {$vendor-dir}/bin (/huayong/app/php/liebite/../LieBitComposer/bin)
[cache-dir] /home/yw/.cache/composer
[data-dir] /home/yw/.local/share/composer
[cache-files-dir] {$cache-dir}/files (/home/yw/.cache/composer/files)
[cache-repo-dir] {$cache-dir}/repo (/home/yw/.cache/composer/repo)
[cache-vcs-dir] {$cache-dir}/vcs (/home/yw/.cache/composer/vcs)
[cache-ttl] 15552000
[cache-files-ttl] 15552000
[cache-files-maxsize] 300MiB (314572800)
[bin-compat] auto
[discard-changes] false
[autoloader-suffix]
[sort-packages] false
[optimize-autoloader] false
[classmap-authoritative] false
[apcu-autoloader] false
[prepend-autoloader] true
[github-domains] [github.com]
[bitbucket-expose-hostname] true
[disable-tls] false
[secure-http] true
[cafile]
[capath]
[github-expose-hostname] true
[gitlab-domains] [gitlab.com]
[store-auths] prompt
[archive-format] tar
[archive-dir] .
[htaccess-protect] 1
[home] /home/yw/.config/composer
2、修改为阿里云的源
composer config repo.packagist composer https://mirrors.aliyun.com/composer/
composer config repo.packagist composer https://packagist.phpcomposer.com
composer config -g --unset repos.packagist
仅修改当前工程配置,仅当前工程可使用该镜像地址:composer config repo.packagist composer https://mirrors.aliyun.com/composer/
composer config --unset repos.packagist
3、执行安装命令
composer require phpoffice/phpspreadsheet
指定命令运行的用户
sudo -u nginx bash -c ‘/usr/local/bin/composer require phpoffice/phpspreadsheet‘
4、composer安装
下载composer.phar文件
https://getcomposer.org/download/1.8.0/composer.phar sudo mv composer.phar /usr/local/bin/composer
chmod a+x /usr/local/bin/composer
参考
5、保持最新版
composer selfupdate
以保持 Composer 一直是最新版本6、调试
composer -vvv require alibabacloud/sdk
7、安装成功