icemix / laravel-fcm-notification-channel
Icemix Firebase Cloud Messages Notification Driver
Installs: 33
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 23
pkg:composer/icemix/laravel-fcm-notification-channel
Requires
Requires (Dev)
- friendsofphp/php-cs-fixer: ^1.12.2
- mockery/mockery: ^1.0
- phpunit/phpunit: 4.*
This package is auto-updated.
Last update: 2025-10-25 23:53:37 UTC
README
This package makes it easy to send notifications using Firebase Cloud Messaging (FCM) with Laravel 5.3. This package is based on brozot/laravel-fcm, so please read that documentation for more information.
Contents
Installation
You can install this package via composer:
composer require icemix/laravel-fcm-notification-channel:1.0
Register the provider directly in your app configuration file config/app.php:
'providers' => [ // ... NotificationChannels\FCM\ServiceProvider::class ]
Usage
Now you can use the channel in your via() method inside the notification:
use NotificationChannels\FCM\FCMMessage; use Illuminate\Notifications\Notification; class ExampleNotification extends Notification { public function via($notifiable) { return ['fcm']; } public function toFCM($notifiable) { return (new FCMMessage()) ->notification([ 'title' => 'Notification title', 'body' => 'Notification body', ]); } }
Available message types:
FCMMessage: Send notifications to device(s).FCMMessageTopic: Send notifications to topic(s).FCMMessageGroup: Send notifications to group(s).
In order for your notice to know who to send messages, you must add routeNotificationForFCM method to your notification model.
Available message methods
data(): Notification data.array|LaravelFCM\Message\PayloadData|LaravelFCM\Message\PayloadDataBuilderoptions(): Notification options.array|LaravelFCM\Message\Options|LaravelFCM\Message\OptionsBuildernotification(): Notification content.array|LaravelFCM\Message\PayloadNotification|LaravelFCM\Message\PayloadNotificationBuilder
Proxy methods. See brozot/laravel-fcm for more information about this methods.
setDryRunsetPrioritysetTimeToLivesetCollapseKeysetDelayWhileIdlesetMutableContentsetContentAvailablesetRestrictedPackageNameisDryRungetPrioritygetTimeToLivegetCollapseKeyisDelayWhileIdleisMutableContentisContentAvailablegetRestrictedPackageNamesetTagsetBodysetIconsetTitlesetSoundsetBadgesetColorsetChannelIdsetClickActionsetBodyLocationKeysetBodyLocationArgssetTitleLocationKeysetTitleLocationArgsgetTaggetBodygetIcongetTitlegetSoundgetBadgegetColorgetChannelIdgetClickActiongetBodyLocationKeygetBodyLocationArgsgetTitleLocationKeygetTitleLocationArgs
Testing
$ composer test
Credits
Support
Having trouble? Open an issue!
License
The MIT License (MIT). Please see License File for more information.