DEV Community

Gentrit Abazi
Gentrit Abazi

Posted on • Updated on

Use Firebase Cloud Messaging In Laravel

Alt Text

In many modern web applications, you need to implement real-time, live-updating user interfaces.

When we update data on the server, a message is typically sent over a connection to be handled by the client. So, you need a real-time channel or WebSocket connection to handle this.

Some Laravel Developers use Pusher to handle this problem. Instead, we are going to use Firebase Cloud Messaging.

What is Firebase Cloud Messaging ?

Firebase Cloud Messaging (FCM) is a cross-platform messaging solution that lets you reliably send messages at no cost.

Using FCM, you can notify a client app that a new email or other data is available to sync. You can send notification messages to drive user re-engagement and retention. For use cases such as instant messaging, a message can transfer a payload up to 4KB to a client app.

How does it work ?

An FCM implementation includes two main components for sending and receiving:

A trusted environment such as Cloud Functions for Firebase or an app server on which to build, target, and send messages.
An iOS, Android, or web (JavaScript) client app that receives messages via the corresponding platform-specific transport service.

How to use Firebase Cloud Messaging in Laravel ?

To send notifications or custom messages in Laravel via Firebase, at Kutia, we made a simple package to do this work easy and fast.

For installation and configuration please refer to the GitHub Link:

https://github.com/kutia-software-company/larafirebase

Top comments (1)

Collapse
 
ramagh profile image
rama-gh

Hi, i'm tying that package, buen when get the notif on my phone is not with the title and body i'm declared, any idea to resolve? Thx (sorry my english)