zelenin/smsru
Laravel/PHP client for sms.ru: send SMS, check delivery status, query balance, and manage sender names via the SMS.ru API. Lightweight wrapper with simple methods for common operations and integration into PHP apps.
sms.ru API calls (e.g., sending, balance checks) via a Service Class or Facade.
class SmsRuService {
public function send(string $phone, string $message): array {
return (new \SmsRu\Client())->send($phone, $message);
}
}
smsru.php for API credentials/endpoints.ShouldQueue jobs for async processing.| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| PHP Version Compatibility | High | Test with PHP 8.1+; use return_type_declaration polyfills if needed. |
| Laravel Version Support | Medium | Abstract Laravel-specific features (e.g., config, queue) via adapters. |
| API Deprecation | High | Monitor sms.ru API changes; plan fallback (e.g., Twilio). |
| Undocumented Behavior | Medium | Write integration tests for critical paths. |
sms.ru the primary SMS provider? If not, evaluate alternatives (e.g., Vonage, AWS SNS) with active support.Notifiable interface)spatie/laravel-sms)str_replace for array_column).composer require zelenin/smsru.sms.ru API responses).Phase 1: Proof of Concept
SmsRuService class.sms.ru API docs for deprecated endpoints.Phase 2: Laravel Integration
config/smsru.php) for credentials.$this->app->singleton(SmsRuService::class, function ($app) {
return new SmsRuService(config('smsru.api_key'));
});
facade(SmsRu::class, SmsRuService::class);
Phase 3: Production Readiness
retry helper or a custom decorator).SmsRuService to support ShouldQueue:
class SendSmsJob implements ShouldQueue {
use Dispatchable, InteractsWithQueue;
public function handle() {
app(SmsRuService::class)->send($this->phone, $this->message);
}
}
SmsSent/SmsFailed events for observability.Carbon.sms.ru API credentials are available.sms.ru API status (e.g., uptimeRobot).sms.ru rate limits and quotas.sms.ru changelogs.sms.ru API limits.| Failure Scenario | Impact | Mitigation |
|---|---|---|
sms.ru API Downtime |
SMS delivery failures | Implement fallback provider (e.g., Twilio). |
| Rate Limit Exceeded | Throttled requests | Add retry logic with jitter. |
| API Key Compromise | Unauthorized SMS sends | Rotate keys; use Laravel Envoy for secure config. |
| PHP Version Incompatibility | Integration failures | Use Docker to pin PHP version. |
| Package Abandonment | No security updates | Fork and maintain; migrate to active package. |
sms.ru API documentation for edge cases (e.g., international numbers).402 for insufficient balance).How can I help you explore Laravel packages today?