- Can I use this bundle directly in Laravel 8/9/10, or do I need a wrapper?
- This bundle is designed for Symfony2 and may not work natively in Laravel. You’ll need to either create a custom Laravel service wrapper or use the underlying `textmagic/sdk` directly. For Laravel, consider abstracting the SDK into a service class with dependency injection to avoid Symfony2 dependencies.
- What Laravel versions officially support this bundle?
- This bundle is not officially supported in Laravel. It’s a Symfony2 bundle, so compatibility depends on how you integrate it. If you’re using Laravel 5.5+, you’ll need to manually bridge Symfony2 components or rewrite parts of the bundle. For Laravel 8+, focus on the `textmagic/sdk` as a standalone library.
- How do I configure API credentials in Laravel if this bundle expects Symfony2’s config.yml?
- Since Laravel uses `.env` files, you’ll need to manually map TextMagic credentials from your `.env` to the bundle’s configuration. Override the bundle’s configuration in your Laravel service provider or create a custom config loader. Example: `config(['textmagic' => env('TEXTMAGIC_CREDENTIALS')])`.
- Is the `textmagic/sdk:dev-master` dependency stable enough for production?
- No, `dev-master` is unstable and not recommended for production. Pin to a stable SDK version (e.g., `textmagic/sdk:1.0.0`) if available, or fork the SDK and maintain your own release. Alternatively, evaluate alternatives like `vonage/client` or `twilio/sdk`, which are more actively maintained.
- Does this bundle support async SMS sending or queueing for Laravel?
- The bundle itself doesn’t include queueing or async capabilities. For Laravel, integrate it with Laravel Queues (e.g., database, Redis, or SQS) by wrapping the SDK in a job. Example: Create a `SendSmsJob` that uses the TextMagic SDK and dispatch it to a queue for background processing.
- How do I handle errors or retries if SMS sending fails?
- The bundle lacks built-in retry logic. Implement retries manually using Laravel’s `retry` helper or a library like `spatie/laravel-retryable`. For critical failures, log errors to a monitoring system (e.g., Sentry) and notify admins via email or Slack. Consider dead-letter queues for persistent failures.
- Can I use this bundle in a microservices architecture with Laravel?
- Direct use is discouraged due to Symfony2 dependencies. Instead, expose SMS functionality as a microservice via an HTTP API (e.g., Lumen or Symfony API Platform) or a message broker (e.g., RabbitMQ, Kafka). Call this service from your Laravel app to decouple SMS logic.
- What PHP versions does this bundle support, and will it work with Laravel’s PHP 8.x?
- The bundle supports PHP 5.3.2+, but the underlying `textmagic/sdk` may not be compatible with PHP 8.x. Test thoroughly in your Laravel environment. If issues arise, consider forking the SDK or switching to a modern alternative like `vonage/client`, which supports PHP 8+.
- Are there alternatives to this bundle for Laravel that are more maintained?
- Yes. For Laravel, consider these alternatives: 1) `vonage/client` (formerly Nexmo) for SMS/voice, 2) `twilio/sdk` for Twilio integration, or 3) `aws/aws-sdk-php` for AWS SNS. These libraries are actively maintained and Laravel-friendly, avoiding Symfony2 dependencies.
- How do I test SMS functionality locally without sending real messages?
- Mock the TextMagic SDK in your Laravel tests using PHPUnit’s `Mockery` or Laravel’s `MockFacade`. Override the SDK’s HTTP client to return mock responses. Example: Use `Http::fake()` in Laravel to intercept requests and assert expected behavior without hitting TextMagic’s API.