问题描述
在Laravel 4中,我正在同时开发2个不同的工作台程序包.程序包可以协同工作,但我想将它们分开.当它们准备就绪时,第二个将取决于通过Composer的第一个,一切都将运行良好(希望如此)...但是现在:如何使第一个ServiceProvider自动启动第二个ServiceProvider,而无需在/app/中编写两行config/app.php ??
In Laravel 4 I'm developing 2 distinct workbench packages at the same time.Packages work in conjunction but I want to keep things separated.When they will be ready, the second will depend on the first one through Composer and everything will run well (hope so)... but now: How to make the first ServiceProvider auto boot the second ServiceProvider without writing two lines in /app/config/app.php ??
现在,它们很不错,可以在/app/config/app.php的"providers"中添加两行,但是我只想添加一行以使事情变得更容易.谢谢
Now they work great adding two lines into 'providers' in /app/config/app.php but I just want to add one line to keep things easier. Thanks
推荐答案
您可以直接在服务提供商中调用register方法来执行此操作.
You can call the register method to do this, directly in your service provider.
$this->app->register('YourServiceProvider');
如果您想在服务提供商之外调用register方法,则需要使用App
Facade.
If you wish to call the register method outside a service provider, you will need to use the App
Facade.
App::register('YourServiceProvider');
这篇关于Laravel workbech软件包如何自动引导另一个工作台软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!