symfony/smsapi-notifier
Symfony Notifier bridge for SMSAPI (smsapi.pl / smsapi.com). Send SMS using an OAuth token via DSN config, with options for sender name, fast delivery priority, and test mode.
spatie/laravel-symfony-messenger), integration is moderate-effort. Otherwise, a custom wrapper is needed.^6.0), which may introduce dependency bloat if unused elsewhere..env or a secrets manager.smsapi://TOKEN@endpoint?from=SENDER) must be mapped to Laravel’s config (e.g., config/services.php).?test=1) should be environment-aware (e.g., APP_ENV=testing).MessageSentEvent) can be mapped to Laravel’s events/queues via:
// Example: Listen to SMS sent events
public function handle(MessageSentEvent $event) {
if ($event->getMessage() instanceof SmsMessage) {
event(new SmsSent($event->getMessage()));
}
}
| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Symfony Dependency Overhead | Medium | Isolate via Composer scripts or a micro-service. |
| SMSAPI API Instability | High | Implement retry logic (e.g., spatie/laravel-retryable). |
| Laravel-Symfony Friction | Medium | Use spatie/laravel-symfony-messenger for DI alignment. |
| Testing Complexity | Low | Mock SMSAPI responses in Pest/Unit tests. |
| Cost Overruns | Medium | Monitor SMSAPI usage via Laravel logs or a custom middleware. |
spatie/laravel-notifier) + Symfony Messenger.Bus facade.composer require symfony/notifier symfony/smsapi-notifier
.env:
SMSAPI_DSN=smsapi://TOKEN@api.smsapi.com?from=SENDER&test=${APP_ENV:=local}
// config/services.php
'smsapi' => [
'dsn' => env('SMSAPI_DSN'),
],
SmsapiService class (Guzzle-based) and bind to Laravel’s container.SmsMessage or custom client calls.// Using Symfony Notifier
$message = new SmsMessage('Your code: 12345', 'Recipient');
$notifier->send($message);
// Using Custom Client
$smsapi->send('+1234567890', 'Your code: 12345');
$mock = Mockery::mock('overload', SMSAPI::class);
$mock->shouldReceive('send')->andReturn(true);
smsapi.pl and smsapi.com.composer require symfony/notifier:^6.4 symfony/smsapi-notifier:^7.4
.env.test=1 in development.SMSAPI_DSN=smsapi://TOKEN@api.smsapi.com?from=SENDER&debug=1
try {
$notifier->send($message);
} catch (\Exception $e) {
Log::error("SMS failed: " . $e->getMessage());
}
interface SmsService {
public function send(string $to, string $message): bool;
}
from= parameter) for cheaper deliveries.config/queue.php.| Failure Mode | Impact | Mitigation |
|---|---|---|
| SMSAPI API Outage | No SMS delivery | Implement fallback providers (e.g., Twilio). |
| Rate Limiting | Throttled requests | Use exponential backoff in retries. |
| Delivery Failures | Undelivered messages | Log failures and retry later. |
| Cost Overruns | Unexpected charges | Set budget alerts in SMSAPI dashboard. |
.env and test.How can I help you explore Laravel packages today?