besanek/laravel-firebase-notifications

Thin layer for integrate Firebase Messaging as Laravel Notifications
41,950
Install
composer require besanek/laravel-firebase-notifications
Latest Version:v5.1.0
PHP:^8.3
License:BSD-3-Clause
Last Updated:Apr 9, 2026
Links: GitHub  ·  Packagist
Maintainer: besanek

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

avto-dev/firebase-notifications-laravel

Notifications channel for Firebase service

15,187 1
spondonit/laravel-fcm-notification

Laravel FCM (Firebase Cloud Messaging) Notification Channel

4,145 0
benwilkins/laravel-fcm-notification

Laravel FCM (Firebase Cloud Messaging) Notification Channel

976,506 208
eloverde-sistemas/ev-fcm-notification

Laravel FCM (Firebase Cloud Messaging) Notification Channel

22,385 0
akshyaraait/laravel-fcm-notification

Laravel FCM (Firebase Cloud Messaging) Notification Channel

1,000 0