symfony/light-sms-notifier
Symfony Notifier bridge for LightSms. Configure via LIGHTSMS_DSN (lightsms://LOGIN:TOKEN@default?from=PHONE) to send SMS messages through your LightSms account using your login, API token, and sender phone number.
Messenger and Notifier components in Laravel’s service container, which introduces architectural friction (e.g., dependency conflicts, DI mismatches). The package’s event-driven, transport-agnostic model aligns with Laravel’s Events and Bus systems but lacks native Laravel integration layers (e.g., Notification channels, Queue workers).Illuminate\Notifications channel system.laravel-notification-channels (e.g., Twilio, Nexmo).SmsNotifierInterface to Laravel’s Notification contracts.ServiceProvider (e.g., SymfonyNotifierServiceProvider).Bus if not isolated..env but lacks validation for LightSMS-specific fields (e.g., from=PHONE format).http-client and options-resolver may conflict with Laravel’s guzzlehttp or symfony/http-foundation.TransportInterface in Laravel’s PHPUnit tests requires custom test doubles.Notification channel).| Risk | Likelihood | Impact | Mitigation |
|---|---|---|---|
| Dependency conflicts | High | Medium | Pin Symfony versions in composer.json; use replace for overlapping packages. |
| Integration complexity | High | High | Start with a proof-of-concept branch; use Laravel’s ServiceProvider to bridge components. |
| Maintenance burden | Medium | Medium | Monitor Symfony updates; contribute fixes to the package or fork if needed. |
| Performance overhead | Low | Low | Benchmark against laravel-notification-channels/twilio; optimize queue workers if latency is critical. |
| Provider lock-in | Low | Medium | Abstract LightSMS transport behind an interface; allow swapping providers via config. |
| Testing challenges | Medium | Medium | Use Laravel’s Mockery to stub Symfony’s TransportInterface; write integration tests with real DSN. |
Is Laravel’s Illuminate\Notifications already in use?
What SMS provider is the primary target?
laravel-notification-channels instead for native support.Are async SMS deliveries required?
Messenger can integrate with Laravel’s Queue, but conflicts may arise with Laravel’s Bus.Bus directly with a custom LightSMS transport.What is the expected SMS volume?
laravel-notification-channels.Is real-time delivery critical?
Are there compliance requirements (e.g., HIPAA, GDPR)?
Monolog) may require extension for Laravel’s Logging stack.Illuminate\Container).Bus if namespaced (e.g., symfony.messenger vs. laravel.bus).http-client can replace Guzzle if configured via Laravel’s HttpClient facade.laravel-notification-channels/twilio: Native Laravel support, but lacks provider abstraction.laravel-notification-channels/twilio for performance/complexity.Notifier and Messenger.// app/Providers/SymfonyNotifierServiceProvider.php
use Symfony\Component\Notifier\Notifier;
use Symfony\Component\Notifier\Bridge\LightSms\LightSmsTransportFactory;
class SymfonyNotifierServiceProvider extends ServiceProvider {
public function register() {
$this->app->singleton(Notifier::class, function ($app) {
$dsn = config('services.lightsms.dsn');
$transport = LightSmsTransportFactory::fromDsn($dsn);
return new Notifier([$transport]);
});
}
}
.env:
LIGHTSMS_DSN=lightsms://LOGIN:TOKEN@default?from=+1234567890
publishes in ServiceProvider.Notification class to use Symfony’s Notifier:
use Symfony\Component\Notifier\Notification\Notification;
use Symfony\Component\Notifier\Notification\SmsNotification;
class LightSmsNotification extends Notification {
public function __construct(string $message) {
parent::__construct(new SmsNotification($message));
}
}
Bus or Symfony’s Messenger:
// Option 1: Laravel Bus
bus()->dispatch(new LightSmsNotification('Your OTP is 1234'));
// Option 2: Symfony Messenger (if isolated)
$this->app->get(Notifier::class)->send(new SmsNotification('Hello!'));
LightSmsTransport in PHPUnit:
$transport = $this->createMock(TransportInterface::class);
$transport->method('send')->willReturn(true);
$notifier = new Notifier([$transport]);
| Laravel Component | Compatibility | Mitigation |
|---|---|---|
Illuminate\Notifications |
Low (no native channel support) | Build a custom channel or wrap Symfony’s Notifier. |
Illuminate\Bus |
Medium (conflicts with Symfony’s Messenger) |
Isolate Symfony’s Messenger in a separate queue connection or use Laravel’s Bus exclusively. |
Illuminate\Queue |
High (can drive Symfony’s Messenger) |
Configure Messenger to use Laravel’s queue connection. |
Illuminate\Container |
High (Symfony components are container-aware) | Bind services via Laravel’s ServiceProvider. |
Illuminate/HTTP |
Medium (Symfony’s http-client may override Guzzle) |
Configure Symfony’s client |
How can I help you explore Laravel packages today?