-->

如何更新一个作曲家包?(How to update a single composer packag

2019-10-22 08:55发布

I know that I can use composer update vendor/package but here's my case.

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?

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"
   }
],

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.

Answer 1:

有超速作曲家弥补的多种方式:

  1. 定义自定义回购,它指向本地路径,并install--prefer-source

     "repositories": [ { "type":"vcs", "url":"/path/to/your/local/package/packageA" } ], "require":{ "package/packageA" : "dev-master" } 

    后续技巧:如果你确切地知道该type的回购,然后将其指定!

    换句话说:不要使用"type":"vcs"如果你可以指定"type":"git""type":"svn" 。 作曲家将跳过通过所有的回购适配器上运行推测正确的了。

  2. 你可以设置赛帝,并为您的项目和它们的依赖(只所需的软件包"require-dependencies": "true" )。 这作为在packagist前方的包代理。 您只需从本地赛帝镜/代理取。


试试这个,禁用默认Packagist库:

{
    "repositories": [
        {
            "packagist": false
        }
    ]
}


文章来源: How to update a single composer package?