2013-12-21 14:30
浏览 41

Laravel 4.1 - 开发人员可以将自己的配置文件添加到我的包中吗?

The package I have developed comes with a set of config files. However I want other devs to be able to add their own, not just configure the default ones.

However, now that I have tried publishing my package to packagist and installing it as a vendor package via composer, it seems that Laravel will ignore config files unless the same file name existed in the original vendor package! This is true even if I explicitly do


Only if that file name exists in the original workbench package does Laravel seem to allow devs to access it.

图片转代码服务由CSDN问答提供 功能建议

我开发的软件包带有一组配置文件。 但是,我希望其他开发人员能够添加自己的开发人员,而不仅仅是配置默认开发人员。

但是,现在我已经尝试将我的包发布到packagist并将其作为供应商包安装 通过作曲家,似乎Laravel将忽略配置文件,除非原始供应商包中存在相同的文件名! 即使我明确地做了

  Config :: get('{package-name} :: {file-name}')


  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongyi4420 2013-12-25 15:12

    Was able to solve this with namespaces for my package config:

    Config::addNamespace('package', __DIR__.'/path/to/config');

    See here for info:

    打赏 评论

相关推荐 更多相似问题