dnna/swiftmailer-enqueue-bundle
Symfony bundle that spools SwiftMailer emails to an Enqueue message queue and consumes them via swiftmailer:spool:send. Adds configurable queue options, receive timeouts, graceful shutdown via signal extension, and optional requeue/retry handling.
HttpClient, Console, or Messenger). If the Laravel app leverages these components, this package aligns well. For pure Laravel (e.g., no Symfony dependencies), the fit is weaker.swiftmailer:spool:send command becomes blocking by design, which may conflict with Laravel’s event-loop or CLI expectations. Requires architectural adjustments (e.g., daemonized workers).Kernel and Bundle system, which Laravel lacks natively. Workarounds:
Swiftmailer, Enqueue) via Laravel’s service container.php-amqplib, predis). If the app already uses Enqueue, integration is straightforward; otherwise, adds complexity.Mail facade, requires middleware to delegate to Swiftmailer.AppKernel, YAML config) may not translate cleanly.max_requeue_attempts: 5). May need customization for production-grade reliability (e.g., dead-letter queues).HttpClient, Console)? If not, is this a hard requirement?swiftmailer:spool:send command integrate with Laravel’s async tasks (e.g., queues, jobs)?Mail facade?spatie/laravel-queueable-mail, laravel-horizon) that avoid Symfony coupling?symfony/mailer, symfony/messenger).enqueue/amqp-ext, enqueue/redis-ext). If the app already uses Enqueue, integration is minimal.HttpClient) or avoid this package.composer require enqueue/redis-ext php-redis
Mail facade, create a middleware to delegate to Swiftmailer:
// app/Providers/AppServiceProvider.php
Mail::extend('swift', function ($app) {
return new Swift_Mailer($app->make(Swift_Transport::class));
});
Kernel or use symfony/flex to load the bundle.config/bundles.php (Symfony 4+) or AppKernel.php.dnna_swiftmailer_enqueue:
# config/packages/dnna_swiftmailer_enqueue.yaml
dnna_swiftmailer_enqueue:
queue:
service_id: enqueue.transport.default.context
key: swiftmailer_spool
max_requeue_attempts: 3
swiftmailer:spool:send (e.g., using supervisor or Kubernetes).Mail facade, ensure compatibility.Mail facade).INFO, RabbitMQ management UI).max_requeue_attempts.Monolog).enqueue:consume processes).swiftmailer:spool:send may require more memory/CPU for large batches. Optimize batch sizes.receive_timeout and max_requeue_attempts based on load.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Enqueue |
How can I help you explore Laravel packages today?