adapik/sms-bundle
Symfony bundle for sending and scheduling SMS via multiple providers (MessageBird, SMS.ru, SMS Aero, SMS Discount, SMS Center). Configure multiple providers, pick one via ProviderManager, create Sms objects with optional delivery time, and send.
symfony/http-client, symfony/options-resolver) or via Lumen (Symfony’s micro-framework). However, Laravel’s service container and event system differ from Symfony’s, requiring abstraction layers.ProviderManager abstracts provider-specific logic, reducing tight coupling. This is valuable for a Laravel app needing multi-provider SMS support without vendor lock-in.ProviderManager via bindings or facades..env or config/sms.php (using config:cache for performance).SmsSent, SmsFailed).yamilovs/sms-bundle vs. adapik/sms-bundle) suggest low maintenance. Risk mitigation:
ProviderManager is not optimized for Laravel’s container.ProviderManager with a Laravel service provider:
// app/Providers/SmsServiceProvider.php
public function register()
{
$this->app->singleton(ProviderManager::class, function ($app) {
return new ProviderManager(
$app->make('config')->get('sms.providers')
);
});
}
// config/sms.php
'providers' => [
'messagebird' => [
'api_key' => env('SMS_MESSAGEBIRD_KEY'),
'base_uri' => 'https://rest.messagebird.com',
],
],
Http facade or Guzzle:
// Adapter for MessageBird
public function send(Sms $sms)
{
$response = Http::withHeaders([
'Authorization' => 'Bearer ' . config('sms.providers.messagebird.api_key'),
])->post('https://rest.messagebird.com/sms/json', [
'originator' => config('sms.originator'),
'recipients' => [$sms->getRecipient()],
'text' => $sms->getMessage(),
]);
return $response->successful();
}
// Listen for SMS sent events
event(new SmsSent($sms, $provider));
.env/config/sms.php.spatie/array-to-object for config parsing).ProviderInterface.HttpClient, OptionsResolver) require rewrites..env.symfony/http-client) don’t conflict with Laravel’s versions.debugbar or telescope to inspect SMS payloads and errors.spatie/rate-limiting) to avoid provider throttling.chunk() or batch() to send SMS in groups.Illuminate\Support\Facades\Cache).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Provider API outage | SMS delivery fails | Implement fallback providers and retry logic with exponential backoff. |
| Rate limiting by provider | Throttled requests |
How can I help you explore Laravel packages today?