PHPackages                             kawankoding/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. kawankoding/laravel-fcm

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

kawankoding/laravel-fcm
=======================

A package to send Firebase notification cross Laravel Application

0.2.9(2y ago)176279.0k—1.3%54[9 issues](https://github.com/kawankoding/laravel-fcm/issues)2PHPPHP ^5.6|^7.0|^8.0|^8.1|^8.2

Since Mar 1Pushed 2y ago8 watchersCompare

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

READMEChangelog (10)Dependencies (1)Versions (31)Used By (2)

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

[](#laravel-fcm)

A simple package that help you send a Firebase notification with your Laravel applications

### Installation

[](#installation)

You can pull the package via composer :

```
$ composer require kawankoding/laravel-fcm "^0.2.0"
```

#### Laravel

[](#laravel)

You must register the service provider :

```
// config/app.php

'Providers' => [
   // ...
   Kawankoding\Fcm\FcmServiceProvider::class,
]
```

If you want to make use of the facade you must install it as well :

```
// config/app.php

'aliases' => [
    // ...
    'Fcm' => Kawankoding\Fcm\FcmFacade::class,
];
```

Next, You must publish the config file to define your FCM server key :

```
php artisan vendor:publish --provider="Kawankoding\Fcm\FcmServiceProvider"
```

This is the contents of the published file :

```
return [

    /**
     * Set your FCM Server Key
     * Change to yours
     */

    'server_key' => env('FCM_SERVER_KEY', ''),

];
```

#### Lumen

[](#lumen)

Add the following service provider to the `bootstrap/app.php` file

```
$app->register(Kawankoding\Fcm\FcmServiceProvider::class);
```

Also copy the [laravel-fcm.php](https://github.com/kawankoding/laravel-fcm/blob/master/resources/config/laravel-fcm.php) config file to `config/laravel-fcm.php`

Add the configuration to the `bootstrap/app.php` file *Important:* this needs to be before the registration of the service provider

```
$app->configure('laravel-fcm');
...
$app->register(Kawankoding\Fcm\FcmServiceProvider::class);
```

Set your FCM Server Key in `.env` file :

```
APP_NAME="Laravel"
# ...
FCM_SERVER_KEY=putYourKeyHere

```

### Methods Ref

[](#methods-ref)

- `->to()`
- `->toTopic()`
- `->data()`
- `->notification()`
- `->priority()`
- `->timeToLive()`
- `->enableResponseLog()`
- `->send()`

### Usage

[](#usage)

If You want to send a FCM with just notification parameter, this is an example of usage sending a FCM with only data parameter :

```
$recipients = [
    'clKMv.......',
    'GxQQW.......',
];

fcm()
    ->to($recipients)
    ->priority('high')
    ->timeToLive(0)
    ->data([
        'title' => 'Test FCM',
        'body' => 'This is a test of FCM',
    ])
    ->send();
```

**NOTE**: By default, Firebase server will queue your notification in 4 weeks. You could change this behavior by setting `->timeToLive(value_in_seconds)`. For example snippet above "-&gt;timeToLive(0)" will skip the queue, the target device (eg. android) must be online when the notification arive, otherwhise the target device will not receive the notification.

If You want to send a FCM to topic, use method toTopic($topic) instead to() :

```
fcm()
    ->toTopic($topic) // $topic must an string (topic name)
    ->priority('normal')
    ->timeToLive(0)
    ->notification([
        'title' => 'Test FCM',
        'body' => 'This is a test of FCM',
    ])
    ->send();
```

If You want to send a FCM with just notification parameter, this is an example of usage sending a FCM with only notification parameter :

```
fcm()
    ->to($recipients) // $recipients must an array
    ->priority('high')
    ->timeToLive(0)
    ->notification([
        'title' => 'Test FCM',
        'body' => 'This is a test of FCM',
    ])
    ->send();
```

If You want to send a FCM with both data &amp; notification parameter, this is an example of usage sending a FCM with both data &amp; notification parameter :

```
fcm()
    ->to($recipients) // $recipients must an array
    ->priority('normal')
    ->timeToLive(0)
    ->data([
        'title' => 'Test FCM',
        'body' => 'This is a test of FCM',
    ])
    ->notification([
        'title' => 'Test FCM',
        'body' => 'This is a test of FCM',
    ])
    ->send();
```

### Logging

[](#logging)

To see the original response from Firebase, call `enableResponseLog()` method before calling the `send()` method.

```
fcm()
    ->to($recipients)
    // ...
    ->enableResponseLog()
    ->send();
```

Then you can check the response log in the file `storage/logs/laravel.log`

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity52

Moderate usage in the ecosystem

Community32

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~97 days

Recently: every ~255 days

Total

28

Last Release

741d ago

PHP version history (4 changes)0.0.5PHP ^5.6|^7.0

0.2.4PHP ^5.6|^7.0|^8.0

0.2.8PHP ^5.6|^7.0|^8.0|^8.1

0.2.9PHP ^5.6|^7.0|^8.0|^8.1|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/84d73cf8f0a6e4d86b7b2d2f23700c2b2ac6f9ffb9df527b8d8e469118250752?d=identicon)[mai92](/maintainers/mai92)

![](https://www.gravatar.com/avatar/84e34e900c0b28509e2425ba292037b7ed768463de78f5e8aa1b4bc9c7b3c22f?d=identicon)[erlangparasu](/maintainers/erlangparasu)

---

Top Contributors

[![sayaamirul](https://avatars.githubusercontent.com/u/12948227?v=4)](https://github.com/sayaamirul "sayaamirul (49 commits)")[![erlangparasu](https://avatars.githubusercontent.com/u/20636828?v=4)](https://github.com/erlangparasu "erlangparasu (19 commits)")[![erlangp](https://avatars.githubusercontent.com/u/84793479?v=4)](https://github.com/erlangp "erlangp (6 commits)")[![ilhamarrouf](https://avatars.githubusercontent.com/u/8977253?v=4)](https://github.com/ilhamarrouf "ilhamarrouf (5 commits)")[![andriyandriyan](https://avatars.githubusercontent.com/u/16184669?v=4)](https://github.com/andriyandriyan "andriyandriyan (4 commits)")[![defji](https://avatars.githubusercontent.com/u/2026606?v=4)](https://github.com/defji "defji (2 commits)")[![bjrnblm](https://avatars.githubusercontent.com/u/2300511?v=4)](https://github.com/bjrnblm "bjrnblm (2 commits)")[![Hayat-Umar](https://avatars.githubusercontent.com/u/12841538?v=4)](https://github.com/Hayat-Umar "Hayat-Umar (2 commits)")[![agustinprod](https://avatars.githubusercontent.com/u/343407?v=4)](https://github.com/agustinprod "agustinprod (1 commits)")[![tamer-dev](https://avatars.githubusercontent.com/u/434489?v=4)](https://github.com/tamer-dev "tamer-dev (1 commits)")[![akrindev](https://avatars.githubusercontent.com/u/33445459?v=4)](https://github.com/akrindev "akrindev (1 commits)")[![baggednismo](https://avatars.githubusercontent.com/u/10716226?v=4)](https://github.com/baggednismo "baggednismo (1 commits)")[![be-geeky](https://avatars.githubusercontent.com/u/15646196?v=4)](https://github.com/be-geeky "be-geeky (1 commits)")[![CrazyFreeMan](https://avatars.githubusercontent.com/u/5445192?v=4)](https://github.com/CrazyFreeMan "CrazyFreeMan (1 commits)")[![ianmustafa](https://avatars.githubusercontent.com/u/5209746?v=4)](https://github.com/ianmustafa "ianmustafa (1 commits)")[![maulayyacyber](https://avatars.githubusercontent.com/u/11194525?v=4)](https://github.com/maulayyacyber "maulayyacyber (1 commits)")[![P-Shakibafar](https://avatars.githubusercontent.com/u/25016184?v=4)](https://github.com/P-Shakibafar "P-Shakibafar (1 commits)")

---

Tags

cloud-messagingfcmfirebasefirebase-notificationlaravellaravel-fcmlaravel-push-notificationsnotifications

### Embed Badge

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

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

###  Alternatives

[mckenziearts/laravel-notify

Flexible flash notifications for Laravel

1.7k1.1M5](/packages/mckenziearts-laravel-notify)[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/apn

Apple APN Push Notification Channel

2021.9M4](/packages/laravel-notification-channels-apn)[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)[illuminate/mail

The Illuminate Mail package.

5910.1M391](/packages/illuminate-mail)

PHPackages © 2026

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