Zend Framework 2 - Composer - Manual installation of custom library is removed at install/update

放肆的年华 提交于 2019-12-24 13:29:43

问题


I wrote an own library and included it manually in my composer/autoload_namespaces.php like I was told here.

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?


回答1:


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.

For example:

{
    "autoload": {
        "psr-0": {
            "Vendor\\Namespace\\": "src/"
        }
    }
}

Full docs on http://getcomposer.org/doc/04-schema.md#autoload



来源:https://stackoverflow.com/questions/13969774/zend-framework-2-composer-manual-installation-of-custom-library-is-removed-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!