当前位置:网站首页>php安装composer
php安装composer
2022-07-03 06:51:00 【AquilaEAG】
composer是 PHP 用来管理依赖(dependency)关系的工具。你可以在自己的项目中声明所依赖的外部工具库(libraries),Composer 会帮你安装这些依赖的库文件。
如何在 CentOS 8 上安装和使用 Composer:
https://www.itcoder.tech/posts/how-to-install-and-use-composer-on-centos-8/
composer如何升级vendor扩展包?
composer.lock文件存在于项目根目录下面,是composer install的产物。由于一般大家的版本号写的都比较宽泛,所以不同的人composer install的最终结果,可能有较大区别。特别是随着时间的推移,很可能composer install初始化的项目,变得不是那么可靠了。
所以,这个时候,composer.lock文件就有其存在的意义。composer install命令会先遵照composer.lock中的版本(也就是说是某个特定的版本号),然后在查找composer.json 安装最新扩展包和依赖(也就是说,版本号可能存在跳跃性了)。那么多成员协作编写php项目的时候,为了保证版本的一致性,比较好的方案是:
把composer.lock文件提交到版本库,其它人执行composer install。
或者把vendor目录也提交到版本库,其它人不用执行任何composer命令。
https://newsn.net/say/composer-update-vendor.html
composer.json和composer.lock到底是什么以及区别?
我们在做项目的时候,总是要安装一些依赖。composer给我们提供了很多方便。直接运行composer install。
当我们运行composer install 将会读取composer.lock文件,进行更新依赖。如果composer.lock不存在或者里面没内容,会执行composer.json,会将最新版本的文件下载到vendor目录里,然后再去更新composer.lock文件。
我们都会把项目部署到github上,可是,当一个项目需要多人合作的时候,为了让所有人都使用与您正在使用的完全相同的依赖项。因此,为了保证这一点,composer官方是建议把composer.lock提交到git上。
每当去更新依赖的时候,都是基于composer.lock,去更新的。
注意:
composer.lock文件阻止您自动获取最新版本的依赖项。要更新到最新版本,请使用composer update命令,但是,一般不要使用update命令,因为update命令将更新所有的依赖到最新,这个动作是危险的,这样很有可能导致,最新类库和你以前写的东西冲突,你以前的代码不可用。
转载于:https://www.cnblogs.com/houss/p/11597396.html
边栏推荐
- DBNet:具有可微分二值化的实时场景文本检测
- The difference between CONDA and pip
- SQL implementation merges multiple rows of records into one row
- Example of joint use of ros+pytoch (semantic segmentation)
- pytorch练习小项目
- Liang Ning: 30 lectures on brain map notes for growth thinking
- Local rviz call and display of remote rostopic
- Chapter 8. MapReduce production experience
- [LeetCode]404. 左叶子之和
- [leetcode] day93 - intersection of two arrays II
猜你喜欢

Application scenarios of Catalan number

DBNet:具有可微分二值化的实时场景文本检测

10万奖金被瓜分,快来认识这位上榜者里的“乘风破浪的姐姐”

【开源项目推荐-ColugoMum】这群本科生基于国产深度学习框架PaddlePadddle开源了零售行业解决方案

2022-06-23 VGMP-OSPF-域間安全策略-NAT策略(更新中)

golang操作redis:写入、读取kv数据

ROS+Pytorch的联合使用示例(语义分割)

Jenkins

机器学习 | 简单但是能提升模型效果的特征标准化方法(RobustScaler、MinMaxScaler、StandardScaler 比较和解析)

“我为开源打榜狂”第一周榜单公布,160位开发者上榜
随机推荐
“我为开源打榜狂”第一周榜单公布,160位开发者上榜
The essence of interview
The pressure of large institutions in the bear market has doubled. Will the giant whales such as gray scale, tether and micro strategy become 'giant thunder'?
Basic teaching of crawler code
Understand software testing
Pytest attempts to execute the test case without skipping, but the case shows that it is all skipped
EasyExcel
Paper notes vsalm literature review "a comprehensive survey of visual slam algorithms"
[untitled] 5 self use history
opencv
VMware virtual machine C disk expansion
Class and object summary
Golang operation redis: write and read hash type data
Error c2017: illegal escape sequence
UNI-APP中条件注释 实现跨段兼容、导航跳转 和 传参、组件创建使用和生命周期函数
instanceof
(翻译)异步编程:Async/Await在ASP.NET中的介绍
Local rviz call and display of remote rostopic
mongodb
[Code] occasionally take values, judge blanks, look up tables, verify, etc