composer的常用操作(composer 2.2.1)

一,查看线上所有的库:

liuhongdi@lhdpc:/data/php/admapi$ composer show --all
查询时间较长,一般不必要

说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest

         对应的源码可以访问这里获取: https://github.com/liuhongdi/
         或: https://gitee.com/liuhongdi

说明:作者:刘宏缔 邮箱: 371125307@qq.com

二,查看帮助

liuhongdi@lhdpc:/data/php/admapi$ composer show --help 

三,查看本地项目已安装的库:

liuhongdi@lhdpc:/data/php/admapi$ composer show —installed
说明:项目目录下 composer.lock存储了通过composer安装的库的信息  

四,查看一个已安装的库的详情:

liuhongdi@lhdpc:/data/php/admapi$ composer show topthink/think-orm

五,  安装一个第三方库:

liuhongdi@lhdpc:/data/php/admapi$ composer require topthink/think-mongo
如图: composer的常用操作(composer 2.2.1) 看到Succeed!表示安装成功

六,升级一个第三方库:

liuhongdi@lhdpc:/data/php/admapi$ composer update topthink/think-mongo

如图:

composer的常用操作(composer 2.2.1)

七,卸载一个第三方库

liuhongdi@lhdpc:/data/php/admapi$ composer remove topthink/think-mongo

如图:

composer的常用操作(composer 2.2.1)

八,查找一个第三方库:

liuhongdi@lhdpc:/data/php/admapi$ composer search topthink/think-mongo
topthink/think-mongo mongodb driver for thinkphp6.0

九,查看composer的版本:

liuhongdi@lhdpc:/data/php/admapi$ composer --version
Composer version 2.2.1 2021-12-22 22:21:31

十,升级 composer版本:

1,查看当前版本:
liuhongdi@lhdpc:/data/php/admapi$ composer --version
Composer version 2.2.1 2021-12-22 22:21:31
2,升级:注意转到root账号下:
root@lhdpc:~# composer selfupdate
Upgrading to version 2.2.3 (stable channel).
   
Use composer self-update --rollback to return to version 2.2.1
3,查看当前版本:
liuhongdi@lhdpc:/data/php/admapi$ composer --version
Composer version 2.2.3 2021-12-31 12:18:53 

 

上一篇:六、PYTHON 学习之装饰器使用


下一篇:php8: 安装yac(yac 2.3.2-dev / php 8.1.1)