- Can I use Symfony Fake SMS Notifier directly in Laravel without extra setup?
- No, this package is designed for Symfony Notifier and requires custom integration in Laravel. You’ll need to create a Laravel Notification channel (e.g., `FakeSmsChannel`) to bridge Symfony’s transport system with Laravel’s notifications. This adds complexity but enables the fake SMS functionality.
- How do I configure Fake SMS Notifier to send SMS as emails in Laravel?
- Set the `FAKE_SMS_DSN` in your `.env` file to `fakesms+email://default?to=dev@example.com&from=no-reply@example.com`. For custom mailers (e.g., Mailchimp), use `fakesms+email://mailchimp?to=dev@example.com&from=no-reply@example.com`. Ensure your Laravel app has Symfony Notifier registered in the service container.
- What Laravel versions support this package?
- This package doesn’t natively support Laravel, but it works with Laravel 10.x if you integrate Symfony Notifier (~50+ dependencies). PHP 8.1+ is required, but Laravel 10.x’s LTS supports PHP 8.1–8.3. Upgrade PHP to 8.4+ for Symfony 7+ compatibility, which may introduce dependency conflicts.
- How do I test SMS notifications in Laravel using this package?
- Create a custom `FakeSmsChannel` in Laravel to dispatch notifications via Symfony Notifier. Use Laravel’s `via()` method to route notifications to the fake channel in development: `return app()->environment('local') ? ['fakesms'] : ['nexmo']`. Test by sending notifications and verifying emails/logs instead of real SMS.
- Will this package conflict with Laravel’s built-in notification testing tools?
- Yes, if you’re using `laravel-notification-testing` or similar, this package may duplicate functionality. Fake SMS Notifier logs or emails SMS content, while Laravel’s tools mock notifications directly. Choose one approach or build a unified solution to avoid redundancy.
- Can I log fake SMS messages instead of sending them as emails?
- Yes, configure the DSN in `.env` to `fakesms+logger://default`. This will log SMS messages via Symfony’s logger (e.g., Monolog). Ensure your Laravel logging configuration doesn’t suppress these logs, or route them to a dedicated channel for clarity.
- How do I switch between fake and real SMS providers in production?
- Use Laravel’s `via()` method to dynamically select channels based on the environment. For example, route to `['fakesms']` in `local` and `['nexmo']` in `production`. Ensure your `.env` file updates the `FAKE_SMS_DSN` or removes it entirely in production to avoid accidental fake SMS delivery.
- Are there alternatives to this package for Laravel?
- Yes, consider Laravel-native solutions like `laravel-notification-testing` for mocking notifications or custom channels that log/email SMS content. For Symfony users, this package is ideal, but Laravel teams may prefer lighter alternatives that avoid Symfony’s dependency overhead.
- How do I handle dependency conflicts between Symfony Notifier and Laravel?
- Symfony Notifier has extensive dependencies (e.g., Symfony Mailer, HTTP Client) that may conflict with Laravel’s ecosystem. Use Composer’s `replace` or `conflict` directives in `composer.json` to manage versions. Test thoroughly in a staging environment to catch conflicts early.
- Does this package support Laravel’s queue system for fake SMS notifications?
- No, this package doesn’t natively integrate with Laravel Queues. To use it with queues, wrap the Symfony Notifier call in a Laravel job and dispatch it via `dispatch()` or `dispatchSync()`. Alternatively, extend the `FakeSmsChannel` to support queued notifications manually.