gdx/p-service-bus-laravel-package
Laravel package integrating the GDX P Service Bus into your app, providing configuration and helpers to publish and consume messages for service-to-service communication via a service bus.
| Risk Area | Severity | Mitigation |
|---|---|---|
| Broker Dependency | Medium | Test with Redis first (lowest friction); RabbitMQ adds complexity. |
| Event Serialization | Low | Uses JSON by default; custom serializers can be added if needed. |
| Laravel Version Gaps | Low | Package is actively maintained; check composer.json for Laravel support. |
| Transaction Boundaries | Medium | Async processing may require compensating transactions for critical paths. |
| Monitoring/Governance | High | Lack of built-in metrics; must integrate with Laravel Horizon or Prometheus. |
| Team Familiarity | Medium | EDA concepts may require upskilling (e.g., message retries, dead-letter queues). |
Event::dispatch() with PServiceBus for cross-service communication.PServiceBus as a drop-in replacement for Laravel Queues where async processing is needed.AppServiceProvider or a dedicated BusServiceProvider.| Component | Compatibility |
|---|---|
| Laravel 9/10 | ✅ Full support (PHP 8.0+) |
| Redis | ✅ Native support (recommended for simplicity) |
| RabbitMQ/AMQP | ✅ Supported but requires additional config |
| Database Queues | ⚠️ Possible but not optimized (use Redis/RabbitMQ for async) |
| Horizon | ✅ Can monitor bus consumers alongside queues |
| ScoutAPM/Datadog | ✅ Works with bus consumers (requires instrumentation) |
Phase 1: Pilot Project
OrderCreated).composer require gdx/p-service-bus-laravel-package..env:
PSERVICE_BUS_CONNECTION=redis
QUEUE_CONNECTION=redis
// config/app.php
'providers' => [
Gdx\PServiceBus\ServiceBusServiceProvider::class,
],
Event::dispatch() with bus publisher:
$bus->publish(new OrderCreatedEvent($order));
$bus->subscribe(OrderCreatedEvent::class, function ($event) {
// Handle event
});
Phase 2: Incremental Rollout
spatie/fractal for serialization).laravel-debugbar to inspect bus activity.monolog).Phase 3: Full Adoption
OrderPaid over AnalyticsEvent).Event::dispatch() with $bus->publish().$bus->dispatch() for async tasks (similar to dispatch(new Job)).handle() methods to bus subscribers.| Step | Dependency | Effort | Owner |
|---|---|---|---|
| 1. Broker Setup | DevOps/Cloud | Low | Infrastructure |
| 2. Package Installation | Composer | Low | Backend |
| 3. Pilot Event Migration | Existing event system | Medium | Backend |
| 4. Consumer Development | Pilot event logic | Medium | Backend |
| 5. DLQ/Monitoring | Pilot results | High | Backend/DevOps |
| 6. Team Training | EDA concepts | Ongoing | Tech Lead |
| 7. Full Rollout | All event types | High | Full Team |
.env; no hardcoded connections.telescope for event tracking.laravel-debugbar for bus activity.How can I help you explore Laravel packages today?