Laravel Event Visualizer
Laravel package to visualize events with their handlers, including jobs to chain them together.
Installation
You can install the package via composer:
composer require jonaspardon/laravel-event-visualizer --dev
You can publish the config file with:
php artisan vendor:publish --tag="event-visualizer-config"
You can publish the views with:
php artisan vendor:publish --tag="event-visualizer-views"
Usage
Visit your-app.test/event-visualizer
on a non-production environment.
Auto discovery
Auto discovery of events and jobs might still fail. If you're using this and encounter errors, please open an issue.
If you want to enable auto discovery, enable auto_discover_jobs_and_events
in your config. This will currently disable manual discovery. If this gives you any problems, you should opt for manual discovery.
Refer to the table below for support.
Syntax | Examples | Supported |
---|---|---|
Static call with inline class | Bus::dispatch(new Job()) |
yes |
Bus::dispatchNow(new Job()) |
yes | |
Bus::dispatchSync(new Job()) |
yes | |
Bus::dispatchToQueue(new Job()) |
yes | |
Bus::dispatchAfterResponse(new Job()) |
yes | |
Event::dispatch(new Event()) |
yes | |
Method call with inline class | $jobDispatcher->dispatch(new Job()) |
yes |
$jobDispatcher->dispatchNow(new Job()) |
yes | |
$jobDispatcher->dispatchSync(new Job()) |
yes | |
$jobDispatcher->dispatchToQueue(new Job()) |
yes | |
$jobDispatcher->dispatchAfterResponse(new Job()) |
yes | |
$eventDispatcher->dispatch(new Event()) |
yes | |
Static call with variable | Bus::dispatch($job) |
yes (WIP) |
Bus::dispatchNow($job) |
yes (WIP) | |
Bus::dispatchSync($job) |
yes (WIP) | |
Bus::dispatchToQueue($job) |
yes (WIP) | |
Bus::dispatchAfterResponse($job) |
yes (WIP) | |
Event::dispatch($event) |
yes (WIP) | |
Method call with variable | $jobDispatcher->dispatch($job) |
yes (WIP) |
$jobDispatcher->dispatchNow($job) |
yes (WIP) | |
$jobDispatcher->dispatchSync($job) |
yes (WIP) | |
$jobDispatcher->dispatchToQueue($job) |
yes (WIP) | |
$jobDispatcher->dispatchAfterResponse($job) |
yes (WIP) | |
$eventDispatcher->dispatch($event) |
yes (WIP) |
Manual discovery
To make sure your listeners and jobs are linked together, add the following snippets wherever applicable:
class ListenerOrJob {
public function handle(): void
{
...
Event::dispatch(Event1::class);
Event::dispatchNow(Event1::class);
Bus::dispatch(Job1::class);
Bus::dispatchNow(Job2::class);
...
}
public static function dispatchesEvents(): array
{
return [
Event1::class,
Event2::class,
];
}
public static function dispatchesJobs(): array
{
return [
Job1::class,
Job2::class,
];
}
}
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.