config/pubsub.php) or service providers.Bus or Events, but for external brokers.DependencyInjection (DI) container vs. Laravel’s Container/Service Provider.EventDispatcher vs. Laravel’s Events/Listeners.symfony/dependency-injection, symfony/event-dispatcher) or wrap the bundle in a Laravel-compatible facade.redis, database) may require adapter layers.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Symfony DI Incompatibility | High | Abstract DI logic via Laravel’s ServiceProvider or use pestframework/symfony for testing. |
| EventDispatcher Conflicts | Medium | Extend Laravel’s Dispatcher or use a decorator pattern. |
| Broker-Specific Quirks | Medium | Implement adapters for Laravel’s queue drivers. |
| Route Definition Complexity | Low | Replace YAML/XML with Laravel’s config() or database-backed routes. |
| Maintenance Burden | Medium | Monitor for Symfony 6.x updates; fork if needed. |
Pest, PHPUnit)?spatie/laravel-symfony-components).Phase 1: Proof of Concept
composer require gos/pubsub-router-bundle
topic.user.created → UserCreatedHandler).services.yaml with Laravel’s AppServiceProvider bindings.Phase 2: Adapter Layer
Router:
// app/Providers/PubSubServiceProvider.php
use Gos\PubSubRouterBundle\Router\RouterInterface;
public function register()
{
$this->app->singleton(RouterInterface::class, function ($app) {
return new LaravelRouterAdapter($app['config']['pubsub.routes']);
});
}
AwsSqsAdapter, RabbitMqAdapter).Phase 3: Route Integration
// config/pubsub.php
'routes' => [
'user.created' => [
'handler' => \App\Handlers\UserCreatedHandler::class,
'priority' => 10,
],
],
$this->app->tag([UserCreatedHandler::class], ['pubsub.handler']);
Phase 4: Testing & Optimization
TestCase.| Component | Compatibility Notes |
|---|---|
| Laravel Container | Requires DI abstraction layer (e.g., symfony/dependency-injection). |
| Queue Drivers | Native drivers (e.g., database) need custom adapters for Pub/Sub. |
| Event System | Can coexist with Laravel Events but may introduce redundancy. |
| Testing | Use pestframework/symfony or mock Symfony components in Laravel tests. |
| Symfony 6.x | Bundle is 2.x; check for breaking changes if upgrading Symfony dependencies. |
Router supports caching).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Router misconfiguration | Messages routed to wrong handlers | Use validation in route definitions. |
| Broker outage | Messages lost or delayed | Implement dead-letter queues and retries. |
| Symfony DI conflicts | Application crashes | Isolate bundle in a separate namespace. |
| Handler failures | Partial processing | Use circuit breakers or Saga patterns. |
| Route definition errors | Silent failures | Add health checks for route validation. |
How can I help you explore Laravel packages today?