- How do I install and configure h-o-sein/kavenegar-laravel in my Laravel project?
- Run `composer require h-o-sein/kavenegar-laravel` to install. Add your Kavenegar API key to your `.env` file under `KAVENEGAR_API_KEY` or configure it manually in your code. The package wraps the official Kavenegar PHP client, so no additional setup is needed beyond the API key.
- Does this package support sending SMS to multiple recipients in a single request?
- Yes, the package allows sending SMS to multiple recipients by passing an array of phone numbers to the `Send` method. Each recipient’s delivery status, message ID, and cost are returned in the response for tracking.
- What Laravel versions does h-o-sein/kavenegar-laravel officially support?
- The package is officially tested with Laravel 8.x. While it may work with Laravel 9 or 10, there’s no explicit testing or documentation for newer versions, so compatibility risks exist. Use `illuminate/support:^8.0` in your `composer.json` to mitigate potential issues.
- How do I handle errors when sending SMS with this package?
- The package includes built-in error handling for `ApiException` (non-200 HTTP responses) and `HttpException` (connection issues). Wrap your API calls in a `try-catch` block to catch and log errors, such as invalid API keys or rate limits.
- Can I use this package for production OTP or transactional SMS without additional setup?
- The package provides basic SMS functionality, but for production use, you should implement queueing (e.g., Laravel Queues) and retry logic to handle failures gracefully. Without these, SMS delivery reliability may be compromised during peak loads or API outages.
- Does h-o-sein/kavenegar-laravel support Kavenegar’s template-based SMS feature?
- No, this package does not support Kavenegar’s template-based SMS feature, which is a core part of their API. If you need templates, you’ll need to use the official `kavenegar/php` client directly or fork this package to add template support.
- How can I log SMS delivery results for auditing or debugging?
- The package returns detailed delivery results (status, message ID, cost, etc.), but it doesn’t include built-in logging. You’ll need to manually store this data in a database table (e.g., `sms_logs`) or use Laravel’s logging system to track SMS activity.
- Are there any known compatibility issues with PHP 8.1 or 8.2?
- The package relies on the `kavenegar/php` client (v1.0.0), which may not be fully compatible with PHP 8.1+. Test thoroughly in your environment, as unpatched vulnerabilities or compatibility gaps could arise. Consider forking the package to update dependencies if needed.
- What alternatives exist if I need more features like webhooks or queue support?
- If this package lacks critical features, consider alternatives like Twilio, Nexmo (Vonage), or AWS SNS, which offer Laravel integrations with built-in queueing, webhook support, and better documentation. These services also provide more robust error handling and scalability.
- How can I contribute or maintain this package for Laravel 10+ support?
- The package is no longer actively maintained (last release in 2020). To add Laravel 10+ support, fork the repository, update dependencies (e.g., `kavenegar/php:^2.0`), and refactor for modern Laravel features like Facades or PSR-15 middleware. Submit a pull request or adopt the package as your own.