如何将项目中的文件添加到Composer Classmap AutoLoad?
这是我的项目的结构,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
这是我的项目的结构,
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
是的,要将项目文件列入Composer AutoLoad ClassMap中,您将其定义为项目(即在其自己的项目中),请使用其自动加载器,然后需要另一个项目。
然后,您将其放在那里。
subproject1/composer.json
subproject2/composer.json
然后在
subproject1
中运行- 虽然不建议 - 当然可以提供该作曲家。
因此,另一个项目不得拥有作曲家。这是
软件包
存储库。这里是一个扩展变体,此外还显示它:
subproject1/composer.json
(subproject2/not-composer-json
hapemcoposer .json
文件)示例性运行:
Yes, to get an out of project file into Composer autoload classmap you define it out of project (that is within its own project), have it in its own autoloader and then require the other project.
You then have it in there.
subProject1/composer.json
subProject2/composer.json
Then run in
subProject1
:In this case - while not recommended - it is certainly possible to provide that composer.json for the path but within the first project.
Therefore the other project must not have a composer.json. This is the
package
repository.Here an extended variant that shows it in addition:
subProject1/composer.json
(subProject2/no-composer-json
has nocomposer.json
file)Exemplary run:
Composer \ autoload \ classLoader ::
Composer\Autoload\ClassLoader::addClassMap()