filament-fcm
Firebase Cloud Messaging integration to Native FilamentPHP Notification Package
يمتدّ من filament
composer require tomatophp/filament-fcm- filament-plugin
- filamentphp
- firebase
- integration
- laravel
إضافات تبني عليها (1)
اقرأني

Filament Firebase Integration
Firebase Cloud Messaging integration to Native FilamentPHP Notification Package
Version Compatibility
| Filament | Laravel | PHP | filament-fcm |
|---|---|---|---|
| v5 | 12.x / 13.x | 8.2+ | 5.x |
| v3 | 10.x / 11.x | 8.1+ | 1.x (v3 branch) |
Using filament-alerts? Use filament-fcm-driver instead: it registers FCM as an alerts driver with a settings page. This package is the standalone integration for the native Filament notifications and has no dependency on filament-alerts or the settings hub.
Installation
after install your package you need to update this keys in your .env file
The Firebase JS SDK is only added to the panel when FIREBASE_API_KEY, FIREBASE_PROJECT_ID, FIREBASE_MESSAGING_SENDER_ID, FIREBASE_APP_ID and FIREBASE_VAPID are set.
after update clear config
then run the migrations (creates the user_has_notifications table that stores the FCM tokens)
and generate the service worker public/firebase-messaging-sw.js (run it again after changing the Firebase keys)
register the plugin on /app/Providers/Filament/AdminPanelProvider.php
and add the trait to your user model
The plugin adds no pages: it renders a small Livewire component at the end of the panel body that asks the browser for notification permission, stores the FCM token of the signed in user (fcm-web for browsers, fcm-api for mobile devices) and shows foreground pushes as Filament notifications.
Usage
you can use the filament native notification and we add some macro for you
or you can send it directly from the user model
Pushes are sent by the queued TomatoPHP\FilamentFcm\Jobs\NotifyFCMJob through the laravel-notification-channels/fcm channel, so run a queue worker in production.
Publish Assets
you can publish config file by use this command
you can publish views file by use this command
you can publish migrations file by use this command
Testing
Other Filament Packages
Checkout our Awesome TomatoPHP