当前位置:网站首页>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
边栏推荐
- [leetcode] day93 - intersection of two arrays II
- On the practice of performance optimization and stability guarantee
- A letter to graduating college students
- Floating menu operation
- Summary of UI module design and practical application of agent mode
- Code management tools
- 方差迭代公式推导
- Software testing assignment - day 3
- [5g NR] UE registration process
- Winter vacation work of software engineering practice
猜你喜欢

Example of joint use of ros+pytoch (semantic segmentation)

【无标题】

golang操作redis:写入、读取hash类型数据

这两种驱蚊成份对宝宝有害,有宝宝的家庭,选购驱蚊产品要注意

The dynamic analysis and calculation of expressions are really delicious for flee

2022 cisp-pte (III) command execution

JMeter linked database

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

Yolov3 learning notes

How to migrate or replicate VMware virtual machine systems
随机推荐
Realize PDF to picture conversion with C #
Unit test notes
The list of "I'm crazy about open source" was released in the first week, with 160 developers on the list
“我为开源打榜狂”第一周榜单公布,160位开发者上榜
EasyExcel
机械观和系统观的科学思维方式各有什么特点和作用
Golang operation redis: write and read kV data
What are the characteristics and functions of the scientific thinking mode of mechanical view and system view
[untitled]
DNS forward query:
ROS+Pytorch的联合使用示例(语义分割)
UTC time, GMT time, CST time
How to plan well?
VMware virtual machine C disk expansion
每日刷題記錄 (十一)
How can the server set up multiple interfaces and install IIS? Tiantian gives you the answer!
数值法求解最优控制问题(一)——梯度法
【无标题】5 自用历程
Basic teaching of crawler code
Error c2017: illegal escape sequence