- What Laravel and PHP versions does this package support?
- This package requires **Laravel 13+** and **PHP 8.3+**. If your project uses an older version, you may need to upgrade or explore alternatives like Laravel 12-compatible forks. Always check the [GitHub repo](https://github.com/misaf/laravel-sms-gateway) for updates.
- How do I install and configure the SMS gateway for a specific provider like Plivo?
- First, install the core package via Composer: `composer require misaf/laravel-sms-gateway`. Then, install the Plivo driver: `composer require misaf/laravel-sms-gateway-plivo`. Publish the config with `php artisan vendor:publish --tag=sms-gateway-config`, and set your API key in `.env` under `SMS_GATEWAY_PLIVO_API_KEY`.
- Can I switch SMS providers dynamically per request in Laravel?
- Yes, this package supports **request-level driver switching**. Use the `Sms::send()` method with a `driver` parameter, like `Sms::send('+1234567890', 'Hello', driver: 'twilio')`. This is useful for multi-tenant apps or region-specific routing.
- Does this package support SMS delivery events or callbacks?
- Yes, the package dispatches `SmsSent` events with request and response data. You can listen to these events in your Laravel event system, queue them for async processing, or log them for analytics. Example: `event(new SmsSent($request, $response));`
- What happens if an SMS provider fails? Are there retry mechanisms?
- The package leverages Laravel’s **HTTP client**, which supports retries via middleware (e.g., `retry` middleware). Configure retries in your provider’s config or use Laravel’s built-in retry logic. For critical failures, consider implementing a fallback driver or dead-letter queue.
- Are there any alternatives if I can’t upgrade to Laravel 13 or PHP 8.3?
- If upgrading isn’t feasible, check for community forks or alternatives like `spatie/laravel-sms` or `overtrue/laravel-sms`. These packages may support older Laravel versions but lack the same driver flexibility. Test thoroughly before migrating.
- How do I test SMS functionality in a staging environment without real costs?
- Use mocking libraries like `mockery` or Laravel’s `Http::fake()` to simulate SMS responses. Configure your `.env` to point to a test provider or sandbox API keys. For example, Twilio offers a sandbox mode for testing. Always validate edge cases like rate limits or failed deliveries.
- Can I extend this package to support a custom SMS provider not listed?
- Yes, the package supports **custom driver registration**. Create a new service provider, bind your driver to the `SmsGateway` interface, and register it in `config/sms.php`. Follow the existing driver structure in the [GitHub repo](https://github.com/misaf/laravel-sms-gateway) for guidance.
- How do I handle rate limits or API throttling from SMS providers?
- Configure retry logic in Laravel’s HTTP client middleware or use the provider’s specific rate-limit headers. The package integrates with Laravel’s HTTP stack, so you can apply global middleware like `retry-after` or `throttle`. Monitor failures via `SmsSent` events and implement exponential backoff if needed.
- Is this package suitable for production use, or should I stick with direct API calls?
- This package is production-ready but has **low community adoption (1 star, 0 dependents)**, so validate provider reliability via direct testing. It offers advantages like dynamic switching, event-driven workflows, and Laravel integration, which may outweigh the risk. For mission-critical apps, consider a hybrid approach: use the package for core logic but wrap provider calls in custom error handling.