ersalak/ersalak-laravel-sms
Laravel package for sending SMS via Ersalak API. Provides facade-based methods for simple SMS, P2P messages, OTP template sends, and message status reports. Easy install via Composer, publish config, and set ERSALAK env credentials.
ErsalakSms::sendSms()) that integrates seamlessly with Laravel’s dependency injection and service container.ersalak-config) allow for easy environment-specific customization (e.g., staging/production credentials).sendSms() returns message IDs, enabling post-send workflows (e.g., logging, retries, or status polling via Laravel’s queue system).SmsServiceContract) for easier mocking/testing.MockFacade or a test double..env overrides)?sendSms() called from a job) for:
retryAfter for failed sends).delay jobs to avoid API throttling).Http testing helpers to mock API responses:
$this->mock(ErsalakSms::class)->shouldReceive('sendSms')->andReturn(['message_id' => '123']);
.env and publish config across environments."laravel/framework": "^8.0").Facade::call() vs. Facade::__callStatic()).ErsalakSms vs. other Sms facades)..env variables.ErsalakSms::sendSms().try-catch blocks and log exceptions.SmsSent events)..env management (e.g., Laravel Envoy or Ansible) to avoid inconsistencies across environments..env updates).ERSALAK_SMS_LOG=true) to diagnose issues.
[ErsalakSms] Send attempt failed for 09120000000: {"error":"InvalidSource","code":400}
throttle middleware).ErsalakSms::getReport()).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Ersalak API downtime | SMS delivery fails | Fallback to email + retry queue. |
| Credential expiration | Authentication failures | Automate credential rotation via Laravel tasks. |
| Rate limiting | Throttled requests | Implement exponential backoff in queue workers. |
| Blacklisted numbers | Messages silently dropped | Log send_to_black_list failures and notify admins. |
| High latency | Poor UX for time-sensitive SMS | Use queues + priority routing (e.g., OTPs first). |
| Cost overruns | Unexpected billing | Set budget alerts and monitor usage via Ersalak dashboard. |
.env setup and credential management.Str::random(6) + sendSms()).ErsalakSms::getReport()).How can I help you explore Laravel packages today?