Zend Framework 2-Composer-在安装/更新时删除了手动安装的自定义库 [英] Zend Framework 2 - Composer - Manual installation of custom library is removed at install/update
问题描述
我写了一个自己的库,并手动将其包含在我的 composer / autoload_namespaces.php
中,就像我被告知此处。
I wrote an own library and included it manually in my composer/autoload_namespaces.php
like I was told here.
在我使用 install
或 update
命令。然后删除此行,尝试使用lib时出现错误。
It works fine until I use the install
or update
command. Then this line is removed and I get an error when trying to use the lib.
任何想法如何防止这种情况发生?
Any ideas how to prevent this?
推荐答案
在另一个线程中获得的建议不是很好。 Composer会使用composer.json中的信息重写自动加载文件,因此您永远不要直接编辑php文件。您应该做的是向您的composer.json添加一个自动加载块。
The suggestions you got in the other thread were not very good ones. Composer rewrites the autoload file with information from composer.json and thus you should never edit the php file directly. What you should do is add an autoload block to your composer.json.
例如:
{
"autoload": {
"psr-0": {
"Vendor\\Namespace\\": "src/"
}
}
}
http://getcomposer.org/doc/04-schema.md#autoload
这篇关于Zend Framework 2-Composer-在安装/更新时删除了手动安装的自定义库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!