kavenegar-laravel) integrates Kavenegar SMS API into Laravel, enabling SMS notifications via a service provider pattern. This fits well in architectures requiring asynchronous SMS delivery (e.g., OTPs, alerts, transactional messages) without blocking the main request flow.Kavenegar::send()). No database migrations or complex setup.sendAfterRegistration).Mockery or Laravel’s partialMock).afterCommit hooks).send() accepts loose parameters). Could add PHP 8 attributes or DTOs for stricter contracts.send() sufficient?Log::channel() or Sentry.)Kavenegar::shouldReceive()).composer require beaumind/kavenegar-laravel
php artisan vendor:publish --provider="Beaumind\Kavenegar\KavenegarServiceProvider"
kavenegar.php API key and default sender.// Synchronous
Kavenegar::send('1234567890', 'Your OTP is 1234');
// Async (recommended)
SendSmsJob::dispatch('1234567890', 'Your OTP is 1234');
Kavenegar facade in tests:
Kavenegar::shouldReceive('send')->once()->with('1234567890', '...');
jobs table (if using database driver).send()).KavenegarServiceProvider or extend the facade for bespoke logic.Log::debug() to inspect Kavenegar responses.| Failure | Impact | Mitigation |
|---|---|---|
| Kavenegar API downtime | SMS delivery fails | Queue retries + fallback provider |
| Invalid API key | All SMS fail | Validate key on startup (e.g., boot()) |
| Rate limiting | Throttled requests | Exponential backoff in queue worker |
| Phone number formatting | Invalid requests | Sanitize inputs (e.g., Str::of()->slug()) |
| Queue worker crashes | Undelivered SMS | Supervisor + dead-letter queue |
send().How can I help you explore Laravel packages today?