Skip to content
This repository was archived by the owner on Dec 11, 2020. It is now read-only.

Commit 1352787

Browse files
committed
Document event hooks
1 parent ac44668 commit 1352787

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

readme.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,3 +528,29 @@ to implement. There is a [microservice counterpart](https://github.com/lucid-arc
528528
to Lucid that you can check out [here](https://github.com/lucid-architecture/laravel-microservice).
529529

530530
With more on the means of transitioning from a monolith to a microservice.
531+
532+
### Event Hooks
533+
534+
Lucid exposes event hooks that allow you to listen on each dispatched feature, operation or job. This is especially useful for tracing:
535+
536+
```php
537+
use Illuminate\Support\Facades\Event;
538+
use Lucid\Foundation\Events\FeatureStarted;
539+
use Lucid\Foundation\Events\OperationStarted;
540+
use Lucid\Foundation\Events\JobStarted;
541+
542+
Event::listen(FeatureStarted::class, function (FeatureStarted $event) {
543+
// $event->name
544+
// $event->arguments
545+
});
546+
547+
Event::listen(OperationStarted::class, function (OperationStarted $event) {
548+
// $event->name
549+
// $event->arguments
550+
});
551+
552+
Event::listen(JobStarted::class, function (JobStarted $event) {
553+
// $event->name
554+
// $event->arguments
555+
});
556+
```

0 commit comments

Comments
 (0)