Download the PHP package laravel-notification-channels/fcm without Composer
On this page you can find all versions of the php package laravel-notification-channels/fcm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laravel-notification-channels/fcm
More information about laravel-notification-channels/fcm
Files in laravel-notification-channels/fcm
Package fcm
Short Description FCM (Firebase Cloud Messaging) Notifications Driver for Laravel
License MIT
Homepage https://github.com/laravel-notification-channels/fcm
Informations about the package fcm
Laravel FCM (Firebase Cloud Messaging) Notification Channel
This package makes it easy to send notifications using Firebase Cloud Messaging (FCM) with Laravel.
Contents
- Installation
- Setting up the FCM service
- Usage
- Available message methods
- Custom clients
- Handling errors
- Changelog
- Testing
- Security
- Contributing
- Credits
- License
Installation
Install this package with Composer:
Setting up the FCM service
This package now uses the laravel-firebase library to authenticate and make the API calls to Firebase. Follow the configuration steps specified in their readme before using this.
After following their configuration steps, make sure that you've specified your FIREBASE_CREDENTIALS
in your .env
file.
Usage
After setting up your Firebase credentials, you can now send notifications via FCM by a Notification class and sending
it via the FcmChannel::class
. Here is an example:
You will have to set a routeNotificationForFcm()
method in your notifiable model.
This method should return the user's FCM token(s) from storage.
For example:
You can also return an array of tokens to send notifications via multicast to different user devices.
Once you have that in place, you can simply send a notification to the user by doing the following:
Available Message methods
View the FcmMessage
source for the complete list of options.
Custom clients
You can change the underlying Firebase Messaging client on the fly if required. Provide an instance of Kreait\Firebase\Contract\Messaging
to your FCM message and it will be used in place of the default client.
Handling errors
When a notification fails it will dispatch an Illuminate\Notifications\Events\NotificationFailed
event. You can listen for this event and choose to handle these notifications as appropriate. For example, you may choose to delete expired notification tokens from your database.
Remember to register your event listeners in the event service provider.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
- Chris Bautista
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of fcm with dependencies
guzzlehttp/guzzle Version ^7.0
illuminate/notifications Version ^10.0|^11.0
illuminate/support Version ^10.0|^11.0
kreait/laravel-firebase Version ^5.7