我知道我可以使用composer update vendor/package,但这是我的情况.
I know that I can use composer update vendor/package but here's my case.
更新时Composer的速度非常慢,我安装了大约6个软件包,并且从本地文件夹加载了一个本地vcs软件包.即使针对该特定本地程序包运行composer update时,composer也会连接到Packagist以查找其他更新,并且此过程非常缓慢,我不知道这是我的计算机还是互联网.有什么方法可以告诉作曲家在运行composer update local/package时仅从本地文件夹更新程序包,而无需联系Packagist并运行它下载的所有繁重的json文件?
Composer is very slow when updating, I have around 6 packages installed and one local vcs package being loaded from a local folder. When I run composer update even for that specific local package, composer connects to Packagist to look for other updates and this process is very slow, I don't know if it's my computer or my internet. Is there a way I can tell composer to just update the package from local folder when I run composer update local/package without contacting Packagist and running through all the heavy json files it downloads?
注意: 我知道如何加载本地作曲家程序包.它的加载非常完美,只是我在寻找一种方法来告诉作曲家仅在不联系Packagist的情况下加载本地包.
Note: I know how to load a local composer package. It's loading perfectly, it's just that I'm looking for a way to tell composer just to load the local package without contacting Packagist.
"repositories": [ { "type": "vcs", "url": "../local/package" } ],我的问题是联系Packagist的速度很慢.运行composer update local/package -vvv表示,即使被告知仅更新local/package,它仍会从packagist下载json文件.
My problem is that it's slow to contact Packagist. Running composer update local/package -vvv Shows that it still downloads json files from packagist even if it's told to update just local/package.
推荐答案有多种方法可以加快Composer的获取速度:
There are multiple ways of speeding the Composer fetch up:
定义自定义存储库,该存储库指向本地路径,并使用--prefer-source "repositories": [ { "type":"vcs", "url":"/path/to/your/local/package/packageA" } ], "require":{ "package/packageA" : "dev-master" }
跟进技巧:如果您完全知道回购的type,请指定它!
Follow-up trick: if you exactly know the type of the repo, then specify it!
换句话说:如果可以指定"type":"git"或"type":"svn",请不要使用"type":"vcs". Composer将跳过所有回购适配器的运行,以找出正确的适配器.
In other words: do not use "type":"vcs" if you can specify "type":"git" or "type":"svn". Composer will skip running through all the repo adapters to figure the correct one out.
您可以设置Satis并仅定义项目及其依赖项("require-dependencies": "true")所需的程序包.在包装专家面前,它充当包装代理.您只需从本地的Satis镜像/代理获取.
you could setup Satis and define only the required packages for your project and their dependencies ("require-dependencies": "true"). This acts as a package proxy in front of packagist. You would simply fetch from the local Satis mirror/proxy.
尝试一下,以禁用默认的Packagist存储库:
Give this a try, to disable the default Packagist repository:
{ "repositories": [ { "packagist": false } ] }更多推荐
如何更新单个作曲家软件包?
发布评论