- How do I install and configure this package for Laravel?
- Run `composer require kaydee123/msg91-laravel` to install. Publish the config file with `php artisan vendor:publish --tag=msg91-config`, then add your MSG91 auth key and base URL to `.env`. The package auto-registers via Laravel’s auto-discovery.
- Does this package support Laravel’s queue system for bulk SMS/OTP?
- No, the package doesn’t natively support queues. For high-volume use, manually dispatch SMS/OTP jobs to Laravel’s queue system using `dispatch()` or `dispatchSync()`. The underlying `kaydee123/msg91-php` library handles individual requests.
- Can I mock MSG91 responses for unit testing?
- The package doesn’t include built-in mocking, but you can stub the `Msg91Client` dependency in tests using Laravel’s `Mockery` or `partialMock`. Override the HTTP client in the `Msg91ServiceProvider` for testing.
- How does this handle MSG91’s DLT compliance for India?
- The package abstracts DLT compliance via template-based SMS (required for India). Ensure your MSG91 template is DLT-approved. The facade’s `template()` method enforces this structure, reducing manual compliance errors.
- What Laravel versions are officially supported?
- The package supports Laravel 8.x through 12.x, leveraging auto-discovery and Facades. It’s compatible with PHP 8.0–8.5, using modern features like named arguments without cutting-edge syntax.
- How do I handle webhooks for SMS delivery receipts?
- MSG91 supports delivery receipts via webhooks, but this package doesn’t include built-in webhook handling. Manually configure MSG91’s webhook endpoint in their dashboard, then validate and process incoming requests in a Laravel route or queue job.
- Is there a fallback if MSG91’s API fails or throttles requests?
- The package claims ‘comprehensive error handling,’ but specifics aren’t documented. For retries, implement Laravel’s `retry()` helper or use a queue with exponential backoff. Monitor failures via Laravel’s logging.
- Can I use this for multi-tenant apps with separate MSG91 keys?
- The package doesn’t natively support multi-tenancy. Override the `Msg91ServiceProvider` to dynamically load config per tenant (e.g., via middleware) or use environment-specific `.env` files for each tenant’s MSG91 credentials.
- What if I need to switch from MSG91 to another provider later?
- Tight coupling to MSG91’s API may complicate provider switches. Abstract the HTTP client layer in your app (e.g., via an interface) to isolate the package. Consider wrapping the facade in a service class for easier future migration.
- Are there any known issues with high-volume OTP sending?
- No async or queue support is documented, so high-volume OTPs may hit rate limits. Use Laravel’s queues to batch requests or implement manual retry logic. Monitor MSG91’s API docs for throttling limits.