ariaieboy/kavenegar-laravel
Laravel integration for the Kavenegar SMS API. Install via Composer, register the service provider and facade, publish config, and set your API key. Then send messages anywhere in your app using the Kavenegar facade.
kavenegar-laravel) integrates Kavenegar, an Iranian SMS gateway, with Laravel, enabling SMS notifications via a clean facade/manager pattern. This aligns well with Laravel’s ecosystem (e.g., Notification channels) but lacks native Laravel compatibility (e.g., no via() support in notifications)..env (e.g., KAVENEGAR_API_KEY).Notification channel (must manually integrate with Notifiable).SmsSent events)..env (no encryption or rotation support).spatie/laravel-sms-notifications or custom Kavenegar HTTP client)?Notification channel support → must integrate manually via:
// Example: Custom Notification Channel
use Ariaieboy\Kavenegar\Facades\Kavenegar;
class KavenegarChannel implements ShouldQueue
{
public function send(User $notifiable, array $data)
{
Kavenegar::send($data['message'], $data['recipients']);
}
}
guzzlehttp/guzzle (managed via Composer).composer require ariaieboy/kavenegar-laravel
.env keys:
KAVENEGAR_API_KEY=your_key
KAVENEGAR_SENDER=your_sender_id
use Ariaieboy\Kavenegar\Facades\Kavenegar;
Kavenegar::send("Hello", ["09123456789"]);
ShouldQueue).Illuminate\Bus\Queueable).Monolog integration).class KavenegarService
{
public function send(string $message, array $recipients): void
{
try {
Kavenegar::send($message, $recipients);
event(new SmsSent($recipients, $message));
} catch (Exception $e) {
Log::error("Kavenegar SMS failed", ['error' => $e]);
throw $e;
}
}
}
SmsGateway) to support multiple providers.Notification channel for consistency.composer.json).Notification system.failed_jobs table).database/redis) for async processing.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Kavenegar API downtime | SMS not delivered | Implement retries + fallback provider. |
| Invalid API key | All SMS fail | Validate .env keys at runtime. |
| Rate limiting | Throttled requests | Add exponential backoff. |
| No queue support | Blocked HTTP responses | Use Laravel queues + ShouldQueue. |
| No logging | Undetected failures | Add custom logging (Monolog). |
| API changes (Kavenegar) | Package breaks | Abstract API calls behind an interface. |
How can I help you explore Laravel packages today?