- Can I use Symfony Fake Chat Notifier with Laravel’s Notification facade (e.g., Notification::send())?
- Yes, but indirectly. The package is designed for Symfony’s Notifier component, which Laravel doesn’t use natively. You’d need to wrap third-party notification channels (e.g., SlackChannel) with this package or use it alongside Laravel’s Mail::fake() for hybrid testing. For pure Laravel channels (e.g., DatabaseChannel), custom adapters are required.
- How do I configure Fake Chat Notifier in Laravel to avoid production leaks?
- Bind the fake notifier in your `AppServiceProvider` with an environment check, like `if (app()->environment('local'))`. Use the DSN format (e.g., `fakechat+email://default?to=test@example.com`) in your `.env` for local/dev only. Never enable fake channels in production—this package is purely for development.
- What Laravel versions support Symfony Fake Chat Notifier?
- Officially, Laravel 8.0+ due to Symfony Notifier v5.4+ dependencies (PHP 8.1+). For Laravel <8.0, you’d need to manually resolve conflicts or fork the package, but this isn’t recommended. Test thoroughly if downgrading, as Symfony’s Notifier may introduce breaking changes.
- Does this package work with Laravel’s Mail::fake() or Log::spy()?
- No, it’s a separate fake transport for chat notifications. Use it alongside Laravel’s built-in fakers (e.g., `Mail::fake()` for emails) or extend it to log fake chat messages for assertions. For example, spy on log output when using `fakechat+logger://default` to verify messages.
- Can I fake Slack/Discord notifications in Laravel tests with this package?
- Yes, if you’re using Symfony’s Notifier with Slack/Discord channels. Wrap the channel in a fake transport using the DSN format (e.g., `fakechat+slack://default`). For Laravel’s native SlackChannel, you’d need to create a custom adapter to bridge it with this package’s fake transport.
- How do I test fake chat notifications in Laravel’s PHPUnit?
- Assert fake chat messages by checking logs (if using `fakechat+logger://`) or by inspecting the fake email content (if using `fakechat+email://`). For example, spy on log entries with `Log::spy()` or verify email content with `Mail::assertSent()`. Custom assertions may be needed for complex message validation.
- What if I need fake WebSocket or custom notification channels?
- The package supports extensibility—you can create custom fake channels by implementing Symfony’s Transport interface. For WebSocket fakes, you’d need to build a custom transport that logs or simulates WebSocket payloads. Check the Symfony Notifier docs for transport implementation details.
- Is this package maintained long-term? Should I use it in production?
- No, this package is for development only. The last release was in 2026 with no active maintenance updates. Avoid using it in production—it’s a fake transport and cannot replace real notification providers for compliance (e.g., GDPR) or audit trails.
- How do I switch between fake and real notification channels dynamically?
- Use Laravel’s config-driven approach: define a `NOTIFIER_DSN` in your `.env` and override it per environment. For example, set `NOTIFIER_DSN=fakechat+email://default` in `.env.local` and `NOTIFIER_DSN=slack://your-token` in `.env.production`. Bind the DSN to Symfony’s Notifier in your service provider.
- Are there alternatives to Symfony Fake Chat Notifier for Laravel?
- For Laravel-specific needs, consider `laravel-notification-fake` (if available) or mock third-party APIs directly in tests. For Symfony Notifier users, this package is the official fake transport. If you need broader fake support (e.g., SMS, push), combine it with Laravel’s `Notification::fake()` or use dedicated fake packages for those channels.