symfony/twilio-notifier
Symfony Notifier bridge for Twilio. Configure via TWILIO_DSN (SID, token, from) to send SMS, and customize messages with TwilioOptions such as webhook URL and other provider-specific settings.
TwilioNotifierService).TwilioChannel with bridge-specific features (e.g., TwilioOptions).laravel/messenger package can replicate Symfony’s Messenger for decoupled notification dispatch.events, Symfony’s event_dispatcher)..env support for TWILIO_DSN aligns with Laravel’s env-based config.notifications + Twilio SDK suffice, this adds unnecessary abstraction.Notifier component may evolve independently of Laravel’s ecosystem.config(['twilio.dsn' => env('TWILIO_DSN')])).SmsMessage with Laravel’s Notification classes (e.g., TwilioMessage extending Mailable).TwilioOptions to Laravel’s macroable notification system (e.g., Sms::to($recipient)->withOptions($options)).bus or horizon).NotificationSentEvent would need Laravel equivalents (e.g., sent:notification events).TransportTestCase won’t work; Laravel’s Mockery or Pest would be needed.LaravelTwilioNotifier) that translates between the two ecosystems.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Symfony Abstraction Leak | High | Isolate Symfony dependencies behind interfaces (e.g., TransportInterface). |
| Queue Incompatibility | Medium | Implement a LaravelQueueTransport adapter for Symfony’s Messenger. |
| Testing Gaps | Medium | Write Laravel-specific tests for Twilio interactions. |
| Maintenance Burden | Low | Monitor Symfony Notifier updates; backport critical fixes. |
| Feature Parity | Low | Compare against Laravel’s native notifications; supplement as needed. |
TwilioOptions and webhooks).ShouldQueue logic or a Messenger-to-Queue bridge.spatie/laravel-twilio) that overlap?
Laravel Compatibility Matrix:
| Laravel Feature | Symfony Bridge Fit | Workaround Needed? |
|---|---|---|
| Service Container | Medium | Use $app->bind() or make:provider. |
| Queues (Horizon) | Low | Custom QueueTransport adapter. |
| Events | High | Map Symfony events to Laravel listeners. |
| Notifications | Medium | Extend Mailable or Notification. |
| Configuration (.env) | High | Direct TWILIO_DSN support. |
| Testing | Low | Rewrite Symfony tests for Pest/Mockery. |
Recommended Stack:
Messenger for async notifications.TwilioOptions (e.g., webhooks, media messages).Notification::send(), custom Twilio logic).notifications + Twilio SDK.symfony/notifier as a standalone dependency.TwilioNotifier service:
class TwilioNotifier implements NotifierInterface {
public function send(SmsMessage $message): void {
// Adapt Symfony's message to Twilio SDK or Laravel Notifications.
}
}
LaravelTwilioTransport to bridge Symfony’s Transport to Laravel’s queues.use Symfony\Component\Notifier\Transport\TransportInterface;
use Illuminate\Bus\Queueable;
class LaravelQueueTransport implements TransportInterface {
use Queueable;
public function __construct(private Queue $queue) {}
public function send(Envelope $envelope): void {
$this->queue->push(new SendTwilioMessage($envelope));
}
}
TwilioOptions-enabled messages.Messenger for async workflows (if needed).^6.0).spatie/laravel-twilio? → Deprecate Spatie or merge logic.laravel-notification-channels/twilio? → Evaluate feature gaps.TwilioOptions support in existing Laravel notifications.LaravelQueueTransport for async support.LaravelQueueTransport) may need updates for Symfony changes.v7.4).How can I help you explore Laravel packages today?