- How do I integrate MessageBird SMS into a Laravel app that doesn’t use Symfony Notifier?
- Use Spatie’s Laravel Notifier wrapper, which bridges Symfony Notifier to Laravel. Install via Composer (`spatie/laravel-notifier`), then configure the MessageBird DSN in `.env` and bind the transport in Laravel’s service provider. This avoids direct Symfony dependency injection.
- What Laravel versions support symfony/message-bird-notifier?
- The package itself is Symfony-focused, but Laravel integration works with Laravel 8+ (or 7.x with Spatie’s Notifier). Ensure your Laravel app uses PHP 8.0+ and Symfony Messenger or Laravel Queues for async support. Test with Spatie’s Laravel Notifier for compatibility.
- Can I send scheduled SMS messages with this package?
- Yes, use `MessageBirdOptions` to set `scheduledDatetime` with a timestamp (e.g., `now()->addHours(2)`). The package forwards this to MessageBird’s API, which handles the delay. Verify timezone settings in your Laravel app to avoid misfires.
- How do I handle delivery receipts or webhooks for tracking?
- Configure a `reportUrl` in `MessageBirdOptions` to receive delivery reports via HTTP callbacks. For webhooks, use Laravel’s `HandleIncomingWebhook` trait or a dedicated route. Note: Custom logic may be needed for parsing MessageBird’s payload format.
- What’s the minimal setup to send an SMS in Laravel?
- Add `MESSAGEBIRD_DSN=messagebird://TOKEN@default?from=SENDER` to `.env`, install `spatie/laravel-notifier` and `symfony/message-bird-notifier`, then send via `$notifier->send(new SmsMessage('+1234567890', 'Hello'))`. No migrations or middleware are required.
- Does this package support templated SMS (e.g., Twig) or dynamic content?
- Plaintext or static templating works out-of-the-box via `SmsMessage` content. For dynamic Twig templates, pre-render the content in Laravel and pass it to the SMS message. Avoid passing raw Twig objects directly to the Notifier.
- How do I test SMS sending without hitting MessageBird’s API?
- Use MessageBird’s sandbox environment (token: `live_...` → `test_...`). Mock the `Texter` interface in PHPUnit or use Laravel’s queue testing tools to verify messages are dispatched correctly. Avoid hardcoding real phone numbers in tests.
- What alternatives exist for MessageBird SMS in Laravel?
- Consider `laravel-notification-channels/messagebird` (direct Laravel Notifications channel) or `notifications-channels/messagebird` (Symfony Notifier alternative). For broader SMS support, evaluate Twilio (`vonage/laravel-communication`) or AWS SNS (`aws/aws-sdk-php`).
- How does this package handle rate limits or API errors?
- Symfony Notifier includes retry logic for transient failures (configurable via `RetryStrategy`). For rate limits, monitor MessageBird’s dashboard or implement a circuit breaker (e.g., `spatie/laravel-circuitbreaker`). Log errors via Laravel’s logging system.
- Can I use this package for high-volume SMS campaigns (e.g., 10K/month)?
- Yes, but validate MessageBird’s pricing and API limits first. Use Laravel Queues or Symfony Messenger for async processing to avoid timeouts. For bulk campaigns, consider MessageBird’s dedicated bulk API or a dedicated service like Postmark.