Laravel Firebase Cloud Messaging Pack

Larafirebase is a package that allows push notifications and sending private messages. 

Firebase uses Firebase Cloud Messaging, a cross-platform messaging solution, to send notifications to client-side users in laravel apps.

toFirebase()special firebasea sample notification class that provides the method of sending notifications through the channel:

use Illuminate\Notifications\Notification;
use Kutia\Larafirebase\Messages\FirebaseMessage;

class SendBirthdayReminder extends Notification
* Get the notification's delivery channels.
public function via($notifiable)
return ['firebase'];

* Get the firebase representation of the notification.
public function toFirebase($notifiable)
$deviceTokens = [

return (new FirebaseMessage)
->withTitle('Hey, ', $notifiable->first_name)
->withBody('Happy Birthday!')
->asNotification($deviceTokens); // OR ->asMessage($deviceTokens);

You must also type client code to use this package. For an example of how to use this package on the client side, see the project's javascript-client folder.

You can check the source code to learn more about this package and get complete installation instructions.


KARABAY A, 2021 . Laravel Firebase Cloud Messaging Pack,

(Accessed February 10, 2021).

  Share this post

Comments (0)


Sign up for the email newsletter to be the first to know about my blog posts