- Can I use symfony/smsapi-notifier directly in Laravel without Symfony components?
- No, this package requires Symfony Notifier (^6.0) as a dependency. For pure Laravel apps, you’ll need to wrap it in a Service Provider or use a custom Guzzle-based client to avoid dependency bloat. Consider `spatie/laravel-notifier` if you want a Laravel-first alternative.
- How do I configure the DSN for SMSAPI in Laravel’s .env?
- Use the format `SMSAPI_DSN=smsapi://TOKEN@api.smsapi.com?from=SENDER&fast=1&test=1`. Replace `TOKEN` with your OAuth key, `SENDER` with your sender name, and set `test=1` for sandbox mode. For SMSAPI.com, omit the `default` endpoint and use `api.smsapi.com` explicitly.
- Does this package support bulk SMS campaigns or only transactional messages?
- This package is optimized for transactional SMS (e.g., OTPs, alerts) and lacks features like bulk discounts or scheduling. For high-volume campaigns, SMSAPI’s direct API or a dedicated bulk SMS service may be more cost-effective.
- How do I handle SMS delivery failures or retries in Laravel?
- Symfony Notifier emits `MessageSentEvent` for sent messages, which you can listen to in Laravel. For retries, pair this with `spatie/laravel-retryable` or implement a custom queue listener. Log failures to monitor delivery issues via Laravel’s logging or a service like Sentry.
- Will this work with Laravel 10 and PHP 8.1+?
- Yes, this package supports Laravel 10+ and PHP 8.1+. However, it depends on Symfony 6.0+, so ensure your `composer.json` constraints align. Test thoroughly in a staging environment to confirm compatibility with your Laravel version.
- Can I use this for two-way SMS (inbound messages) or only outbound?
- This package is one-way only (outbound SMS). For two-way SMS, you’ll need SMSAPI’s webhook integration or a separate package like `laravel-sms` that supports inbound message handling via HTTP endpoints.
- How do I test SMS delivery without sending real messages?
- Enable test mode by appending `&test=1` to your DSN or dynamically set it via environment variables (e.g., `APP_ENV=testing`). Mock SMSAPI responses in unit tests using libraries like Mockery to simulate successful or failed deliveries.
- What’s the cost difference between ‘fast’ and normal SMS delivery?
- SMSAPI’s ‘fast’ mode (`fast=1`) prioritizes delivery speed but incurs higher costs. Check your SMSAPI dashboard for exact pricing. For cost-sensitive apps, avoid `fast` unless SLAs require it, and monitor usage via Laravel logs or a custom middleware.
- Are there alternatives to this package for Laravel SMS?
- Yes. For Symfony Notifier integration, consider `spatie/laravel-notifier`. For lightweight solutions, use Guzzle-based clients like `nesbot/carbon` (for HTTP) or `laravel-sms` (for provider-agnostic SMS). If you’re already using Symfony components, this bridge is efficient.
- How do I integrate this with Laravel’s queue system for async SMS?
- Symfony Notifier can work with Laravel queues if you use `spatie/laravel-symfony-messenger` to bridge Symfony’s Messenger component. Dispatch SMS messages to a queue (e.g., `smsapi->send($message)->toQueue('sms'))` and process them asynchronously with Laravel Horizon or database queues.