- How do I integrate this package into a Laravel project?
- Use the `ALLMYSMS_DSN` environment variable (e.g., `allmysms://LOGIN:APIKEY@default?from=FROM`) in your `.env` file. Wrap the Symfony `Texter` in a Laravel service to dispatch SMS messages asynchronously via queues (e.g., `ShouldQueue`). Example: Create a facade like `Sms::send()` to abstract the Symfony Notifier logic.
- Does this package support Laravel’s job queues (e.g., Horizon) for async SMS delivery?
- Yes. You can extend the Symfony `Texter` to implement Laravel’s `ShouldQueue` trait, allowing SMS messages to be processed asynchronously. This is ideal for high-volume applications or to avoid timeouts during peak traffic.
- What Laravel versions does this package support?
- The package is fully compatible with Laravel 10+ (PHP 8.4+). For Laravel 9.x, you may need Symfony 6.x polyfills or custom wrappers. Older Laravel versions (pre-8.0) are not officially supported due to Symfony Notifier’s PHP 8.1+ requirement.
- Can I customize SMS delivery options like scheduling or simulation?
- Yes. Use the `AllMySmsOptions` class to configure advanced features like scheduling (`date()`), simulation (`simulate(1)`), campaign names (`campaignName()`), or unique identifiers. These options are passed directly to AllMySms’s API.
- How do I handle SMS delivery failures or retries in Laravel?
- Leverage Laravel’s queue workers (e.g., Horizon) for retries. Emit custom events like `SmsFailed` to trigger fallback actions (e.g., sending an email). The package’s decoupled design allows you to integrate with Laravel’s exception handling or notification channels.
- Is this package better than native Laravel SMS packages like `laravel-notification-channels/allmysms`?
- This package offers deeper AllMySms API integration (e.g., campaign tracking, scheduling) via Symfony Notifier, but it adds Symfony dependencies. For simpler use cases, `laravel-notification-channels/allmysms` may be lighter. Choose this if you need advanced AllMySms features or already use Symfony components.
- How do I test SMS sending without hitting AllMySms’s API?
- Mock the Symfony `Texter` or AllMySms’s HTTP responses in your tests. Use Laravel’s HTTP client or Guzzle to stub API calls. For integration tests, consider a local AllMySms sandbox environment or a test API key with rate limits disabled.
- What are the performance implications of using Symfony Notifier in Laravel?
- Symfony Notifier adds a small overhead due to its abstraction layer. For high-throughput applications, consider replacing Symfony’s `HttpClient` with Laravel’s HTTP client or Guzzle for better performance. Benchmark under your expected load to assess impact.
- Does this package support GDPR/HIPAA compliance for SMS logs?
- The package itself doesn’t enforce compliance, but AllMySms’s API may offer logging/audit features. Review AllMySms’s documentation for retention policies. For compliance, implement custom logging (e.g., Laravel’s `Log` facade) to track SMS metadata and ensure data handling aligns with your requirements.
- How do I migrate from a custom AllMySms solution to this package?
- Start by replacing direct API calls with the Symfony `Texter` in a pilot phase (e.g., for OTPs). Abstract AllMySms logic behind an interface to ease future provider swaps. Gradually replace custom SMS handlers with the package’s `SmsMessage` and `AllMySmsOptions` classes.