PHPackages                             kemalnw/laravel-fcm - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. kemalnw/laravel-fcm

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

kemalnw/laravel-fcm
===================

A Laravel package to sent notification using Firebase Cloud Messsaging (FCM)

v1.0.5(5y ago)0720MITPHPPHP ^7.2CI failing

Since Jan 6Pushed 5y ago1 watchersCompare

[ Source](https://github.com/kemalnw/laravel-fcm)[ Packagist](https://packagist.org/packages/kemalnw/laravel-fcm)[ RSS](/packages/kemalnw-laravel-fcm/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (5)Versions (7)Used By (0)

Laravel FCM
===========

[](#laravel-fcm)

[![Latest Version on Packagist](https://camo.githubusercontent.com/38ebabd1e2007111ffe079cb5680f8534064f33c6374d4658a064d8d63272723/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b656d616c6e772f6c61726176656c2d66636d3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kemalnw/laravel-fcm)[![Software License](https://camo.githubusercontent.com/c27f58b9ccb45ac90bcb4c0be7d69d7439f80d62b729bda413cad5e434423993/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b656d616c6e772f6c61726176656c2d66636d3f7374796c653d666c61742d737175617265)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/c48d54c20287b50171f9b057c869e21b6a95b42d4920b0449d323f67ea32d699/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b656d616c6e772f6c61726176656c2d66636d3f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kemalnw/laravel-fcm)

A Laravel package to sent notification using Firebase Cloud Messsaging (FCM)

### Installation

[](#installation)

Require the `kemalnw/laravel-fcm` package in your `composer.json` and update your dependencies:

```
composer require kemalnw/laravel-fcm
```

Configuration
-------------

[](#configuration)

You must publish the config file to define your firebase server key :

```
php artisan vendor:publish --tag="fcm"
```

This is the content of the config file published at `config/fcm.php`

```
/**
 * Define your firebase server key
 */
return [
    'server_key' => env('FIREBASE_SERVER_KEY', ''),
];
```

Usage
-----

[](#usage)

Use artisan command to create a notification:

```
php artisan make:notification SomeNotification
```

Change the `via` method so that it becomes:

```
/**
 * Get the notification channels.
 *
 * @param  mixed  $notifiable
 * @return array|string
 */
public function via($notifiable)
{
    return ['fcm'];
}
```

Add method `toFcm` to your notification, and return an instance of `Fcm` Facade.

```
use Fcm;

...

/**
 * Get the FCM representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return void
 */
public function toFcm($notifiable)
{
    return Fcm::notification([
            'title' => 'Hi!',
            'body'  => 'This is my first notification.'
        ])
        ->timeToLive(604800); // 7 days in second
}
```

When sending to specific device, the notification system will automatically look for a `firebase_uid` property on your notifiable entity. You may customize which `firebase token` is used to deliver the notification by defining a `routeNotificationForFcm` method on the entity:

```
...

class User extends Authenticatable
{
    use Notifiable;

    /**
     * Route notifications for the FCM channel.
     *
     * @param  \Illuminate\Notifications\Notification  $notification
     * @return string
     */
    public function routeNotificationForFcm($notification)
    {
        return $this->firebase_uid;
    }
}
```

When sending to a topic, you may define so within the `toFcm` method in the notification:

```
use Fcm;

...

/**
 * Get the FCM representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return void
 */
public function toFcm($notifiable)
{
    return Fcm::notification([
            'title' => 'Hi!',
            'body'  => 'This is my first notification.'
        ])
        ->timeToLive(604800) // 7 days in second
        ->toTopic('topic-name');
}
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~59 days

Recently: every ~74 days

Total

6

Last Release

2020d ago

PHP version history (2 changes)v1.0.0PHP ^7.0

v1.0.3PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/9d10b30d430833fc6881495ba6a0dbc807001fd414375a3a738a51326f4e8f02?d=identicon)[kemalnw](/maintainers/kemalnw)

---

Top Contributors

[![kemalnw](https://avatars.githubusercontent.com/u/22442435?v=4)](https://github.com/kemalnw "kemalnw (7 commits)")

---

Tags

fcmfcm-notificationsfirebaselaravellaravel-fcmlaravel-packagenotification

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kemalnw-laravel-fcm/health.svg)

```
[![Health](https://phpackages.com/badges/kemalnw-laravel-fcm/health.svg)](https://phpackages.com/packages/kemalnw-laravel-fcm)
```

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/fcm

FCM (Firebase Cloud Messaging) Notifications Driver for Laravel

5917.0M16](/packages/laravel-notification-channels-fcm)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/microsoft-teams

A Laravel Notification Channel for Microsoft Teams

1603.0M7](/packages/laravel-notification-channels-microsoft-teams)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[laravel-notification-channels/aws-sns

Amazon Simple Notification Service (AWS SNS) notification channel for Laravel.

541.1M2](/packages/laravel-notification-channels-aws-sns)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
