本文章来为各位介绍一篇关于composer 将远程的包更改为本地开发模式,希望文章能够帮助到各位同学。
有时候我们会遇到线上的 composer 开发包功能不是很完善,但是很多功能我们还能够用到,我们只能自己去修改一部分代码让这个包能够去运行,同时不使用 composer 进行更新,否则代码会再更新的时候再次被覆盖掉。
下边是以下几个步骤:
在 composer.json 中去掉调用
一般情况下,去掉包,包在进行更新的时候会自己删除。
在 vendor/composer/installed.json 中去掉这个已经安装的引用
这样在再次安装的时候这个包就会保留到本地,不会被删除掉。
在 composer.json 中加入对这个包的命名空间的映射
因为composer 的包都会自动进行加载,如果没有进行加载,则也是找不到这个文件,所以需要对命名空间做下映射
比如我们引用一个第三方包,他的命名空间是这样的:
"autoload": {
"psr-4": {
"Imvkmark\\L5Thumber\\": "src/L5Thumber"
}
},
我们需要在根目录下的 composer.json加入
"autoload": {
"psr-4": {
"Imvkmark\\L5Thumber\\": "vendor/imvkmark/l5-thumber/src/L5Thumber",
}
},
这样便能够对包的命名空间进行映射,同时进行修改了。
更新 composer.json
其实到这里已经结束,并且完成了自己的功能了。
这样我们可以不受顾忌的修改代码,并且同时给作者发送推送请求,等待作者更新这个代码,然后我们再改回来,这样我们又能够使用最新的库了。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
