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

Commit f89ecf6

Browse files
committed
Document event hooks
1 parent 46207de commit f89ecf6

File tree

1 file changed

+26
-30
lines changed

1 file changed

+26
-30
lines changed

readme.md

+26-30
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,32 @@ Route::get('/users', 'UserController@index');
140140

141141
That's it! Now serve the application with `php artisan serve` and visit `http://localhost:8000/users`
142142

143+
### Event Hooks
144+
145+
Lucid exposes event hooks that allow you to listen on each dispatched feature, operation or job. This is especially useful for tracing:
146+
147+
```php
148+
use Illuminate\Support\Facades\Event;
149+
use Lucid\Foundation\Events\FeatureStarted;
150+
use Lucid\Foundation\Events\OperationStarted;
151+
use Lucid\Foundation\Events\JobStarted;
152+
153+
Event::listen(FeatureStarted::class, function (FeatureStarted $event) {
154+
// $event->name
155+
// $event->arguments
156+
});
157+
158+
Event::listen(OperationStarted::class, function (OperationStarted $event) {
159+
// $event->name
160+
// $event->arguments
161+
});
162+
163+
Event::listen(JobStarted::class, function (JobStarted $event) {
164+
// $event->name
165+
// $event->arguments
166+
});
167+
```
168+
143169
---
144170

145171
## Monolith vs. Microservice
@@ -172,33 +198,3 @@ and work on it until it gets so big that it is crucial to be dissected into sing
172198
It would be challenging to be able to figure out the different services your application would need moving forward.
173199

174200
This project is also useful when you know for sure that your application will not have to deal with multiple Services but you would still like to use Lucid.
175-
176-
---
177-
178-
# Laravel PHP Framework
179-
180-
[![Build Status](https://travis-ci.org/laravel/framework.svg)](https://travis-ci.org/laravel/framework)
181-
[![Total Downloads](https://poser.pugx.org/laravel/framework/d/total.svg)](https://packagist.org/packages/laravel/framework)
182-
[![Latest Stable Version](https://poser.pugx.org/laravel/framework/v/stable.svg)](https://packagist.org/packages/laravel/framework)
183-
[![Latest Unstable Version](https://poser.pugx.org/laravel/framework/v/unstable.svg)](https://packagist.org/packages/laravel/framework)
184-
[![License](https://poser.pugx.org/laravel/framework/license.svg)](https://packagist.org/packages/laravel/framework)
185-
186-
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable, creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as authentication, routing, sessions, queueing, and caching.
187-
188-
Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb inversion of control container, expressive migration system, and tightly integrated unit testing support give you the tools you need to build any application with which you are tasked.
189-
190-
## Official Documentation
191-
192-
Documentation for the framework can be found on the [Laravel website](http://laravel.com/docs).
193-
194-
## Contributing
195-
196-
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](http://laravel.com/docs/contributions).
197-
198-
## Security Vulnerabilities
199-
200-
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
201-
202-
## License
203-
204-
The Laravel framework is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)