pmatseykanets / artisan-beans

Easily manage your Beanstalkd job queues right from the Laravel artisan command

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Registering commands in register()

segadora opened this issue · comments

Should commands be registered in boot?

https://github.com/pmatseykanets/artisan-beans/blob/master/src/ArtisanBeansServiceProvider.php#L20

As mentioned previously, within the register method, you should only bind things into the service container. You should never attempt to register any event listeners, routes, or any other piece of functionality within the register method. Otherwise, you may accidentally use a service that is provided by a service provider which has not loaded yet.

https://laravel.com/docs/5.4/providers#the-register-method
https://laravel.com/docs/5.3/providers#the-register-method

No they shouldn't. All we do we bind commands to an IoC container.
For reference see ArtisanServiceProvider.php