Zend Framework 2 - Composer - Manual installation

2019-08-01 05:48发布

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条回答
对你真心纯属浪费
2楼-- · 2019-08-01 06:17

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

查看更多
登录 后发表回答