- Can I use symfony/spot-hit-notifier directly in a Laravel project without Symfony components?
- No, this package is tightly coupled with Symfony’s Notifier, Messenger, and DependencyInjection. You’ll need to build custom adapters for Laravel’s HttpClient, Queue system, and Service Container, which may introduce complexity. Consider alternatives like spatie/laravel-notification-channels-sms for a Laravel-native solution.
- How do I configure Spot-Hit SMS in Laravel using this package?
- You’ll need to manually translate Symfony’s DSN format (e.g., `spothit://TOKEN@default?from=FROM`) into Laravel’s config/services.php. Use environment variables for `SPOTHIT_DSN`, `SPOTHIT_FROM`, and optional flags like `smslong`. A custom resolver or facade will be required to parse the DSN for Laravel’s HTTP client.
- Does this package support Laravel’s queue system for SMS delivery?
- No, the package relies on Symfony’s Messenger component, which doesn’t natively integrate with Laravel’s queue system. You’d need to create a custom transport adapter or use Laravel’s Bus facade to dispatch messages, but this may not replicate Symfony’s retry or middleware logic.
- What Laravel versions are compatible with symfony/spot-hit-notifier?
- The package itself doesn’t enforce Laravel version constraints, but compatibility depends on your custom integration layer. Laravel 8+ is recommended due to its improved HTTP client and dependency injection. Test thoroughly, as Symfony’s HttpClient (PSR-18) may behave differently than Laravel’s Guzzle-based client.
- How do I handle long SMS (>160 chars) in Laravel with this package?
- Use the `smslong` and `smslongnbr` query parameters in your DSN (e.g., `?smslong=1&smslongnbr=2`). The package will manage concatenation, but you’ll need to ensure your Laravel wrapper passes these flags correctly to Spot-Hit’s API. Test with long messages to validate behavior.
- Are there alternatives to this package for Laravel Spot-Hit SMS integration?
- Yes, consider spatie/laravel-notification-channels-sms or a custom Laravel Notification channel. These avoid Symfony dependencies and integrate natively with Laravel’s queue system and notifications framework. They may lack Spot-Hit’s advanced features like long-SMS handling but offer smoother Laravel compatibility.
- Will this package work with Laravel’s testing tools like Pest or PHPUnit?
- Not out of the box. Symfony-specific tests (e.g., TransportFactoryTestCase) won’t run in Laravel’s environment. You’ll need to rewrite tests using Laravel’s HTTP testing helpers or mock the custom transport layer. Focus on testing your adapter’s integration with Spot-Hit’s API.
- How do I register the Spot-Hit Notifier service in Laravel’s container?
- Use an AppServiceProvider to bind the Symfony Notifier service to Laravel’s container. For example, register `SpotHitNotifier` as a singleton with your DSN config. However, this requires Symfony’s DependencyInjection, which may conflict with Laravel’s native container. A facade or custom resolver is often a simpler workaround.
- Does this package support retries or error handling for failed SMS deliveries?
- Symfony’s Notifier includes retry middleware, but this won’t work directly in Laravel. You’ll need to implement retries manually using Laravel’s queue system or HTTP client retry logic. Spot-Hit’s API docs should guide you on handling HTTP errors (e.g., 429 for rate limits).
- What are the performance implications of using this package in Laravel?
- Performance depends on your custom integration. Symfony’s HttpClient is optimized, but Laravel’s Guzzle-based client may introduce slight latency. For production, test under load and consider caching API responses if Spot-Hit’s rate limits are a concern. Queue-based delivery can also help with throttling.