symfony/firebase-notifier
Symfony Notifier bridge for Firebase Cloud Messaging. Configure via FIREBASE_DSN and send notifications with platform-specific options using AndroidNotification, IOSNotification, or WebNotification to customize icons, sounds, actions, and more.
Symfony-Laravel Hybrid Viability:
ChatMessage abstraction) allows integration with Laravel via Symfony’s Notifier component or a custom bridge. This fits Laravel’s service container and event-driven architecture if wrapped in Laravel-compatible interfaces (e.g., Illuminate\Bus\Queueable).Notification facade with Symfony’s ChatterInterface for cross-platform (Android/iOS/web) push notifications.AndroidNotification, IOSNotification, and WebNotification classes without rewriting payload logic for each platform./topics/news) aligns with Laravel’s broadcast channels (e.g., Pusher, Redis).Illuminate\Notifications uses a facade pattern, while Symfony Notifier relies on dependency injection. Requires a translation layer (e.g., a LaravelNotifierBridge class).Firebase API Alignment:
kreait/firebase-php for HTTP v1 features, but this adds complexity.Illuminate\Bus\Dispatcher to use Symfony’s Chatter).database, redis), but requires custom retry logic for failed FCM deliveries.Notification facade with Symfony Notifier for Firebase-specific notifications (e.g., FirebaseNotification class).symfony/http-client).firebase://USER:PASS@default) works, but service account JSON (recommended by Firebase) requires additional logic.AndroidNotification/IOSNotification classes require manual validation to prevent malformed FCM payloads.Illuminate\Bus\PendingDispatch).messenger and notifier components, which may conflict with Laravel’s existing Symfony bundles..env conventions.kreait/firebase-php or a hybrid approach.LaravelNotifierBridge vs. sticking with Illuminate\Notifications.failed_jobs table).laravel.log).| Step | Action | Laravel Component | Symfony Component | Risk Level |
|---|---|---|---|---|
| 1. Setup | Install Symfony Notifier and Firebase Notifier via Composer. | composer require symfony/notifier firebase-notifier |
symfony/notifier, firebase-notifier |
Low |
| 2. Configure DSN | Add FIREBASE_DSN to .env (or use service account JSON). |
.env |
firebase://USER:PASS@default |
Low |
| 3. Create Bridge | Build a Laravel-compatible Chatter interface (e.g., FirebaseChatter). |
app/Services/FirebaseChatter.php |
Symfony\Component\Notifier\ChatterInterface |
Medium |
| 4. Define Notifications | Extend ChatMessage for Firebase-specific payloads. |
app/Notifications/FirebaseNotification.php |
Symfony\Component\Notifier\Message\ChatMessage |
Low |
| 5. Register Transport | Bind Symfony’s FirebaseTransport to Laravel’s service container. |
config/services.php |
Symfony\Component\Notifier\Transport\FirebaseTransport |
Medium |
| 6. Send Notifications | Replace Notification::send() with FirebaseChatter::send(). |
app/Jobs/SendFirebaseNotification.php |
ChatterInterface |
Low |
| 7. Handle Failures | Customize retry logic for Laravel queues. | app/Exceptions/Handler.php |
Symfony\Component\Notifier\RetryStrategy |
High |
| 8. Test | Validate payloads, retries, and cross-platform delivery. | phpunit |
Symfony’s Notifier tests | High |
kreait/firebase-php.How can I help you explore Laravel packages today?