Debugging & Observability for Event-Driven Architectures:
Developer Productivity & Onboarding:
fetchListeners('user.created')).Build vs. Buy Decision:
Roadmap Priorities:
php artisan debug:listeners).Use Cases:
PaymentFailedEvent) didn’t trigger expected listeners (e.g., sendRefundEmail).UserPasswordReset) have the correct access controls (e.g., private listeners).20% of bug reports involve event misfires or propagation issues.
addListener calls).ListenerGraph CLI command).EventDispatcher + closures, not DIC tags).Event::listen('user.created', fn() => ...)).spatie/laravel-debugbar, laravel-horizon, or custom middleware.symfony/profiler, blackfire.io.*"This is a zero-cost, open-source tool to reduce event-related debugging time by 30–50%, saving ~100 dev hours/year for our Symfony2/Laravel apps. Here’s why it’s worth prioritizing:
OrderCancelledEvent trigger the refund?’) cost us $X/year in dev time and lost revenue.user.created triggers sendWelcomeEmail’).debug:listeners CLI command."*"This package gives us programmatic access to Symfony2’s event listener registry, which we can adapt for Laravel to:
fetchListeners('user.created')).ListenerGraph command to visualize event flows).Pros:
Cons:
ListenerFetcher to work with Laravel’s EventDispatcher.Suggestion:
ListenerFetcher to use app('events')->getListeners().debug:listeners Artisan command.EventDispatcher or Debugbar may suffice.ListenerFilter could be ported.Example Use Case:
# Future CLI command (after adaptation)
php artisan debug:listeners user.created
# Output:
# - sendWelcomeEmail (priority: 0)
# - logUserCreation (priority: 10)
# - notifyAdmin (priority: 20, private: true)
```"
---
### **For Developers**:
*"If you’re tired of **spending hours** tracing why `OrderPlacedEvent` isn’t triggering your listener, this tool can help. Here’s how it works:
1. **Install**:
```bash
composer require egulias/listeners-debug
$fetcher = new ListenerFetcher($containerBuilder);
$listeners = $fetcher->fetchListeners(); // All listeners
$filtered = $fetcher->fetchListener('user.created'); // Specific event
app('events')->getListeners().{
"user.created": [
{ "listener": "App\Listeners\SendWelcomeEmail", "priority": 0 },
{ "listener": "App\Listeners\LogUserCreation", "priority": 10 }
]
}
Why This Matters:
addListener in 50+ files.How can I help you explore Laravel packages today?