Events Listeners
Events and Listeners
A ServiceProvider must be created for events and listeners.
The ServiceProvider for events must
Create Event Service Provider Class YourPackageEventServiceProvider
under your-package/src/Providers/YourPackageEventServiceProvider.php
and extend with EventServiceProvider
Minimal example:
namespace YourVendor\YourPackage\Providers;
use Filefabrik\Bootraiser\WithBootraiserEvent;
use Illuminate\Foundation\Support\Providers\EventServiceProvider;
class YourPackageEventServiceProvider extends EventServiceProvider
{
use WithBootraiserEvent;
public function register()
{
parent::register();
$this->registeringEvents();
}
}
Remember to register this event service provider in the composer.json of the respective package:
your-package/composer.json
...
"extra": {
"laravel": {
"providers": [
"YourVendor\\YourPackage\\Providers\\YourPackageServiceProvider",
"YourVendor\\YourPackage\\Providers\\YourPackageEventServiceProvider"
]
}
}
...
References
Last updated on