- Can I use this package directly in a Laravel app without Symfony components?
- No, this package requires Symfony Notifier. For a pure Laravel solution, consider wrapping the SmsBiuras API directly in a custom service or using a Laravel-compatible SMS package like `laravel-notification-channels/sms`. The Symfony dependency adds complexity unless your app already uses Symfony components.
- How do I configure the DSN in Laravel’s `.env` file?
- Use a format like `SMSBIURAS_DSN=smsbiuras://UID:API_KEY@default?from=FROM&test_mode=0`. Extract values in `config/services.php` and construct the DSN dynamically. Validate required fields (UID, API_KEY) manually, as Laravel’s `.env` doesn’t enforce DSN structure.
- Will this work with Laravel’s queue system for async SMS delivery?
- Indirectly, but you’ll need to bridge Symfony Notifier to Laravel queues. Dispatch Laravel jobs (e.g., `SendSmsJob`) from Symfony’s MessageBus or use a custom `QueueTransport` to map Symfony messages to Laravel queues. Test mode (`test_mode=1`) won’t integrate with Laravel’s `Queue::fake()`.
- What Laravel versions and PHP versions are supported?
- This package depends on Symfony 8+, which requires PHP 8.4+. Laravel 10+ (PHP 8.2+) may work with minor adjustments, but Laravel 11+ (PHP 8.4+) is fully compatible. Check Symfony’s [requirements](https://symfony.com/doc/current/setup.html) for exact versions.
- How do I handle errors or failed SMS deliveries in Laravel?
- Catch Symfony’s `NotificationFailedException` and log it via `Log::error()` or convert it to a Laravel exception. For retries, configure Symfony Messenger’s retry logic separately from Laravel’s queue retries to avoid conflicts. Use Laravel’s `failed` queue table for tracking failed jobs.
- Can I use this for production without adding Symfony to my project?
- No, the package is a Symfony Notifier bridge and requires Symfony components. For production, either adopt Symfony Notifier (adding ~10MB to your vendor directory) or refactor the DSN logic into a lightweight Laravel service. Monitor delivery metrics via Laravel’s Horizon or a custom observer.
- Are there alternatives for sending SMS in Laravel without Symfony?
- Yes. For SmsBiuras specifically, create a custom Laravel service wrapping the API. For multi-provider support, use `laravel-notification-channels/sms` (Twilio, Nexmo) or `spatie/laravel-sms`. These avoid Symfony dependencies and integrate natively with Laravel’s Notification system.
- How do I test SMS sending in Laravel with this package?
- Use `test_mode=1` in the DSN to send test SMS without charges. Mock Symfony’s `NotifierInterface` in PHPUnit tests to avoid real API calls. For Laravel queue testing, use `Queue::fake()` but note it won’t interact with Symfony’s test mode. Combine both for full coverage.
- Can I extend this to support other SMS providers like Twilio or Nexmo?
- Not directly. The package is Biuras-specific. For multi-provider support, abstract the transport logic into a `SmsProviderInterface` and create adapters (e.g., `SmsBiurasTransport`, `TwilioTransport`). Symfony Notifier’s design supports this, but you’d need to implement the interfaces manually.
- What’s the best way to integrate this with Laravel’s Notification system?
- Create a custom `SmsBiurasChannel` extending Laravel’s `ChannelInterface`. Use Symfony Notifier internally but expose Laravel’s `Notification` facade. Example: `Notification::route('sms', $user)->notify(new SmsNotification)`. This keeps Laravel’s event/queue systems intact while leveraging Symfony’s transport.