symfony/message-bird-notifier
Symfony Notifier bridge for MessageBird SMS. Configure via MESSAGEBIRD_DSN (token, from sender) and send SmsMessage notifications. Supports MessageBirdOptions to set SMS API options like scheduling, validity, report URL, and URL shortening.
Notification system. This introduces minimal architectural overhead if Laravel’s event/queue systems are already in place.Bus or Dispatchers.MessageBirdOptions, useful for compliance or analytics tracking.Notification channels. Options:
Channel class to use Symfony’s Transport.Notifier instance.// app/Channels/MessageBirdChannel.php
use Symfony\Component\Notifier\Notifier;
use Symfony\Component\Notifier\Message\SmsMessage;
class MessageBirdChannel implements Channel
{
public function __construct(private Notifier $notifier) {}
public function send($notifiable, SmsMessage $message) {
$this->notifier->send($message);
}
}
symfony/notifier, symfony/http-client, and symfony/messenger via Composer.guzzlehttp/guzzle or symfony/http-client. Resolve via:
conflict-resolution or platform-check.composer.json.spatie/laravel-symfony-components to integrate Symfony packages cleanly.| Risk Area | Mitigation Strategy |
|---|---|
| API Latency | Implement queue-based delivery (Laravel Queues + Symfony Messenger) to avoid blocking requests. |
| Error Handling | Use Laravel’s FailedJob events + Symfony’s FailedMessage events to log failures in a central system (e.g., Sentry, database). |
| Configuration Drift | Centralize MessageBird credentials in Laravel’s .env and validate via config/caching. |
| Testing Complexity | Mock Symfony’s Transport interface in PHPUnit/Pest: |
```php
$this->mock(Symfony\Component\Notifier\Transport\TransportInterface::class)
->shouldReceive('send')
->once();
```
| Deprecation | Pin Symfony Notifier to LTS versions (e.g., ^6.4) and monitor Symfony’s deprecations. |
Notification classes vs. MessageBird’s template IDs.)RetryStrategy or Laravel’s retry-after middleware.MessageBirdOptions.Notification facade with a custom MessageBirdChannel (see PoC above).database, redis) for reliability.OrderShipped) → Symfony Notifier.# config/services.yaml (Symfony-style, adapt for Laravel)
framework:
notifier:
transports:
messagebird:
dsn: '%env(MESSAGEBIRD_DSN)%'
options:
from: 'YourSender'
Phase 1: Proof of Concept (1–2 weeks)
composer require symfony/notifier symfony/http-client symfony/messenger
MessageBirdChannel (as above) and test with a hardcoded DSN.Notification::send() and verify delivery.Phase 2: Core Integration (2–3 weeks)
MESSAGEBIRD_DSN in .env:
MESSAGEBIRD_DSN=messagebird://API_KEY@default?from=YourSender
AppServiceProvider).SmsMessage payloads).Phase 3: Advanced Features (1–2 weeks)
MessageBirdOptions in Laravel’s Notification classes:
public function toMessageBird($notifiable) {
return (new SmsMessage($notifiable->phone))
->options((new MessageBirdOptions())
->reference($this->orderId)
->scheduledDatetime($this->scheduledAt)
);
}
2. Add **webhook validation** for delivery receipts (if needed).
3. Integrate with **Laravel Telescope** for debugging.
Phase 4: Rollout & Optimization
try-catch in the channel to fall back to a secondary provider (e.g., Twilio)..env prior to deployment.How can I help you explore Laravel packages today?