- Can I use Symfony SmsBiuras Notifier in a pure Laravel app without Symfony components?
- Yes, but you’ll need to wrap the Symfony Notifier service in a Laravel service provider. Bind the `SmsBiurasNotifier` to Laravel’s container and use Symfony’s `HttpClient` or `Messenger` via Laravel’s queue system if needed. This requires manual setup but avoids full Symfony dependency.
- What Laravel versions are compatible with this package?
- The package itself is Symfony-focused, but it works with Laravel if you integrate Symfony components like `symfony/http-client` or `symfony/messenger`. Laravel 8.x+ is recommended for compatibility with Symfony 5.4+ dependencies. Test thoroughly for version conflicts.
- How do I configure the DSN for SmsBiuras in Laravel’s `.env` file?
- Use the DSN format in your `.env`: `SMSBIURAS_DSN=smsbiuras://YOUR_UID:API_KEY@default?from=YOUR_SENDER&test_mode=1`. For Laravel, bind this to a config variable (e.g., `config('services.sms_biuras.dsn')`) and pass it to the Symfony Notifier service.
- Does this package support asynchronous SMS delivery (queues) in Laravel?
- Yes, but you’ll need to bridge Symfony Messenger with Laravel’s queue system. Use a custom queue listener or map Symfony messages to Laravel’s `ShouldQueue` interfaces. Retry logic may require adjustments to align with Laravel’s `failed_jobs` table.
- What happens if SmsBiuras’ API changes or goes down? Can I switch providers?
- The package is tightly coupled to SmsBiuras, so API changes may break functionality. For provider flexibility, consider abstracting the SMS client behind an interface (e.g., `SmsProviderInterface`) and implementing adapters for other services like Twilio or AWS SNS.
- How do I handle errors or failed SMS deliveries in Laravel?
- Laravel’s exception handler can catch Symfony Notifier exceptions. For async failures, check Laravel’s `failed_jobs` table. Log errors using Laravel’s `Log` facade or configure Symfony’s Monolog to write to Laravel’s log channels for consistency.
- Can I use this package for OTP (one-time password) SMS in Laravel?
- Absolutely. The package supports sending SMS via DSN, making it ideal for OTPs. Store the OTP in Laravel’s session or database, then trigger the SMS using `Notifier->send()`. Enable `test_mode=1` during development to avoid charges.
- Are there alternatives to this package for Laravel SMS notifications?
- Yes. For Laravel-native solutions, consider `laravel-notification-channels/sms` (Twilio, Nexmo) or `spatie/laravel-sms`. If you need Biuras specifically, this package is the most direct option, but it lacks multi-provider support out of the box.
- How do I test SMS sending in Laravel without real charges?
- Use the DSN’s `test_mode=1` parameter to send test SMS. Mock the Symfony Notifier in unit tests by replacing its dependencies with Laravel’s `Mockery` or PHPUnit’s `createMock()`. For integration tests, verify the DSN and response handling without hitting the live API.
- Does this package work with Laravel’s Horizon for queue monitoring?
- Indirectly. If you use Symfony Messenger with Laravel queues, Horizon can monitor job progress. However, you’ll need to customize the job payload to include SMS metadata (e.g., recipient, status) and ensure Symfony’s retry logic aligns with Laravel’s queue workers.