erfanhemmati/kavenegar
Laravel integration for the Kavenegar SMS API. Install via Composer, register the service provider and facade, publish the config, and set your API key in config/kavenegar.php to start sending SMS from your Laravel app.
Mail, Cache).kavenegar/php (core SDK) and minimal Laravel dependencies (no heavy frameworks like Symfony).vendor:publish, reducing boilerplate and enabling environment-specific overrides (e.g., staging/production API keys).send() could return bool|array|string).config)?monolog?Mail::send()).sendSms, verifyLookup).Kavenegar::send('1234567890', '1234', 'Your OTP: {otp}', ['otp' => $code]);
php artisan vendor:publish --provider="Kavenegar\Laravel\ServiceProvider").php -v and composer validate.Kavenegar interface if needed).SendSmsJob:
use Kavenegar\Facades\Kavenegar;
use Illuminate\Bus\Queueable;
class SendSmsJob implements Queueable {
public function handle() {
Kavenegar::send(...);
}
}
sms_logs table.composer.json and run composer install.config/app.php.php artisan vendor:publish).Mockery:
$mock = Mockery::mock('alias:Kavenegar')->shouldReceive('send')->once()->andReturnTrue();
.env overrides).KavenegarException (customize error handling).kavenegar/php for breaking changes (no semantic versioning in README).Illuminate\Support\Facades\Input)..env validation.config:clear and cache:clear for config issues.Kavenegar::setDebug(true); // If available
spatie/laravel-circuitbreaker).redis-queue with sleep() in job).failed_jobs table for throttled jobs.SendSmsJob::dispatch($to, $template, $params)->delay(now()->addSeconds(5));
| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Kavenegar API downtime | SMS delivery fails | Fallback to email or local caching. |
| Invalid API key | All SMS calls fail silently | Validate key in boot() and log errors. |
| Rate limit exceeded | Jobs queue up indefinitely | Implement retry logic with jitter. |
| Template parsing errors | SMS sent with incorrect placeholders | Validate templates before sending. |
| Database connection issues | Async jobs fail to log | Use failed_jobs table + dead-letter queue. |
default_sender).How can I help you explore Laravel packages today?