kavenegar/laravel
Laravel integration for Kavenegar SMS/voice API. Install via Composer, register the service provider and facade, publish the config, and set your Kavenegar API key. Then call the Kavenegar facade anywhere in your app to send messages.
SmsSent, SmsFailed) for observability or workflows (e.g., retries, analytics).guzzlehttp/guzzle), making it easy to integrate without polluting the global namespace or requiring deep architectural changes.ServiceProvider and Facade patterns, which remain stable.Kavenegar::send($message, $receptor, $sender)), reducing coupling to the underlying HTTP client. This simplifies future API updates (e.g., switching to GraphQL or SDK).vendor:publish ensures environment-specific API keys and settings (e.g., sandbox vs. production) without hardcoding.kavenegar/php library (v1.0.0) is also outdated. Risk of breaking changes if Kavenegar’s API evolves (e.g., new endpoints, auth methods).bindIf).Illuminate\Support\Facades\Log or custom exceptions.Kavenegar::send()).sent, failed) for workflows like:
composer.json and publish config:
composer require kavenegar/laravel
php artisan vendor:publish --provider="Kavenegar\Laravel\ServiceProvider"
.env with KAVENEGAR_API_KEY and sandbox/production settings.Kavenegar::send()).$this->app->bind(KavenegarClient::class, function ($app) {
return new KavenegarClient($app['config']['kavenegar.api_key']);
});
| Laravel Feature | Compatibility | Mitigation |
|---|---|---|
| Laravel 10+ HTTP Client | ❌ Uses Guzzle v6 (L10+ defaults to v7) | Create a Guzzle v7 adapter or use Laravel’s HTTP client directly. |
| Dependency Injection | ✅ Works, but lacks type hints | Add PHP 8+ types or use bindIf for conditional binding. |
| Queued Jobs | ✅ Supports async via Laravel Queues | Wrap Kavenegar::send() in a job class. |
| Events | ❌ No built-in events | Extend the package or emit custom events post-send. |
| Testing | ❌ No tests | Write test cases for critical paths (e.g., KavenegarTestCase). |
storage/logs).SmsSent/SmsFailed.throttle middleware)..env).kavenegar/php (v1.0.0), which may lack updates.CONTRIBUTING.md.Kavenegar::send() is self-documenting).How can I help you explore Laravel packages today?