besanek/laravel-firebase-notifications
Laravel Firebase Notifications
Thin layer for integrate Firebase Messaging as Laravel Notifications
Requirement
- PHP >= 8.3
- Laravel >= 11.x
Installing
$ composer require "besanek/laravel-firebase-notifications"
This is all, thanks to the Package Autodiscover.
Setup
Please follow configuration guide of kreait/laravel-firebase
Basic Usage
Add new method routeNotificationForFirebase to your notifiable entity, witch returns device id.
/**
* It could be one device
*/
public function routeNotificationForFirebase()
{
return $this->device_id;
}
/**
* Or you can return array for multicast
*/
public function routeNotificationForFirebase()
{
return $this->devices()->get()->pluck('id');
}
In Notification entity you should add firebase to via() method.
public function via(): array
{
return ['firebase', /* 'email', 'database', 'etc...'*/];
}
And you can construct CloudMessage into toFirebase() method.
public function toFirebase(): Messaging\CloudMessage
$notification = Messaging\Notification::create('I <3 laravel', 'It is true');
return Messaging\CloudMessage::new()->withNotification($notificatin);
}
Please look into the official PHP SDK documentation for the full use of all possibilities.
Related Packages
spondonit/laravel-fcm-notification
Laravel FCM (Firebase Cloud Messaging) Notification Channel
4,314
0
eloverde-sistemas/ev-fcm-notification
Laravel FCM (Firebase Cloud Messaging) Notification Channel
22,880
0
benwilkins/laravel-fcm-notification
Laravel FCM (Firebase Cloud Messaging) Notification Channel
978,439
208
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v5.1.0 | ^8.3 | ^11.0| | BSD-3-Clause or GPL-2.0 or GPL-3.0 | |
| v5.0.0 | ^8.2 | ^11.0| | BSD-3-Clause or GPL-2.0 or GPL-3.0 | |
| v4.2.1 | ^8.0 | ^10.0| | BSD-3-Clause or GPL-2.0 or GPL-3.0 | |
| v4.2.0 | ^8.0 | ^10.0| | BSD-3-Clause or GPL-2.0 or GPL-3.0 | |
| v4.1.0 | ^8.0 | ^10.0| | BSD-3-Clause or GPL-2.0 or GPL-3.0 | |
| v4.0.0 | ^8.0 | ^10.0 | ||
| v3.0.0 | ^8.0 | ^9.0 | ||
| v2.0.0 | ^7.4| | ^8.0 | ||
| v1.1.0 | ~7.1 | ^5.5| | ||
| v1.0.1 | ~7.1 | ~5.5 | ||
| v1.0.0 | ~7.1 | ~5.5 |