php 在没有“composer update”的情况下更新 Composer 自动加载文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27495208/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Updating Composer autoload files without `composer update`?
提问by jevon
I'm working on a project which has a lot of dependencies which I personally control. Whenever the namespace mapping changes in a requirement, I need to run composer update
to refresh the Composer autoload file so the namespace mappings can be picked up.
我正在开发一个项目,该项目有很多我个人控制的依赖项。每当需求中的命名空间映射发生变化时,我都需要运行composer update
以刷新 Composer 自动加载文件,以便可以选择命名空间映射。
However if I'm making changes in the vendor/
directory directly, there's no need to check out the latest versions through composer update
-- all I need is to refresh the autoload file. For a project with dozens of requirements hosted on GitHub, composer update
can take minutes.
但是,如果我vendor/
直接在目录中进行更改,则无需检查最新版本composer update
——我需要的只是刷新自动加载文件。对于托管在 GitHub 上的具有数十项需求的项目,composer update
可能需要几分钟时间。
Is there any way to get composer
to refresh the autoload files withouthaving to run composer update
?
有什么方法可以composer
在无需运行的情况下刷新自动加载文件composer update
?
回答by Sven
composer install
and/or composer dump-autoload
would do the same.
(dump-autoload documentation)
composer install
和/或composer dump-autoload
会做同样的事情。(转储自动加载文档)
回答by David Newcomb
There are some interesting tips here that allow directly editing the source files in the vendor directory and composer to work together.
这里有一些有趣的提示,允许直接编辑供应商目录中的源文件和 Composer 一起工作。