Download the PHP package numesia/laravel-events without Composer
On this page you can find all versions of the php package numesia/laravel-events. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download numesia/laravel-events
More information about numesia/laravel-events
Files in numesia/laravel-events
Package laravel-events
Short Description Laravel package that helps to send events across components
License MIT
Informations about the package laravel-events
NU_EVENTS_LaravelPackage
Laravel package that helps to send events across components
This laravel event package is a private package so we can't just require it using composer, that's why we have to add a vcs repository to tell composer from which url the package must be loaded.
"repositories": [
{
"type": "vcs",
"url": "[email protected]:NUMESIA/NU_EVENT_LaravelPackage.git"
}
],
"require": {
"NUMESIA/laravel-events": "0.0.*"
},
Once this has finished, you will need to add the service provider to the providers array in your app.php config as follows:
Numesia\NuEvent\Providers\NuEventServiceProvider::class,
Next, also in the app.php config file, under the aliases array, you may want to add NuEvent facades.
'NuEvent' => Numesia\NuEvent\Facades\NuEvent::class,
Then publish configs
php artisan vendor:publish --provider="Numesia\NuEvent\Providers\NuEventServiceProvider" --tag=config
Finally, you will want to change your NUEVENT_TOKEN
key from .env
file:
NUEVENT_TOKEN=YourEventSecretKey
How to use ?
NuEvent comes with a global function nuEvent() which help you te send easily events to other components
$components can be a string (bpm), an array ['bpm', 'cms'] or nothing to broadcast to all components
You can Also use the Facade NuEvent if you want to perform the same task
/!\ When you send an event, NuEvent add automatically a suffix 'nuEvents:' to your event name
Example
In this example we will try to send an event from book to bpm
BOOK Component
All we have to do is adding this command somewhere
BPM Component
We should create a listener (don't forget to add it into your EventServiceProvider)
-
EventServiceProvider
- NuEventSubscriber
// App\Listeners\NuEventSubscriber