PHPackages                             smirltech/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. [API Development](/categories/api)
4. /
5. smirltech/laravel-fcm

ActiveLibrary[API Development](/categories/api)

smirltech/laravel-fcm
=====================

Laravel Firebase Cloud Messaging.

v1.0.2(2y ago)09361MITPHPPHP ^8.1

Since Aug 31Pushed 2y agoCompare

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

READMEChangelogDependencies (9)Versions (4)Used By (0)

[![](/art/cover.png)](/art/cover.png)

 [ ![Total Downloads](https://camo.githubusercontent.com/26635f5bec742f5cad49310a7c10c61956794f3137d4b66696f20810ea63c605/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736d69726c746563682f6c61726176656c2d66636d) ](https://packagist.org/packages/smirltech/laravel-fcm) [ ![Latest Stable Version](https://camo.githubusercontent.com/8774336c6deb5061ad6bb01b415a1239c7b0653acebca62e68c5f2d106db8833/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736d69726c746563682f6c61726176656c2d66636d) ](https://packagist.org/packages/smirltech/laravel-fcm) [ ![License](https://camo.githubusercontent.com/be0adcf34556de8b2aed8632d6fd241b106e59f2036b846ff32a4b8a5178a204/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736d69726c746563682f6c61726176656c2d66636d) ](https://packagist.org/packages/smirltech/laravel-fcm)

### Introduction

[](#introduction)

**LaravelFcm** is a package thats offers you to send push notifications or custom messages via Firebase in Laravel.

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

For use cases such as instant messaging, a message can transfer a payload of up to 4KB to a client app.

### Installation

[](#installation)

Follow the steps below to install the package.

**Composer**

```
composer require smirltech/laravel-fcm

```

**Copy Config**

Run `php artisan vendor:publish --provider="SmirlTech\LaravelFcm\Providers\LaravelFcmServiceProvider"` to publish the `laravel-fcm.php` config file.

**Get Athentication Key**

Get Authentication Key from

**Configure laravel-fcm.php as needed**

```
'server_key' => '{FCM_SERVER_KEY}'

```

### Usage

[](#usage)

Follow the steps below to find how to use the package.

Example usage in **Controller/Service** or any class:

```
use SmirlTech\LaravelFcm\Facades\LaravelFcm;

class MyController
{
    private $deviceTokens =['{TOKEN_1}', '{TOKEN_2}'];

    public function sendNotification()
    {
        return LaravelFcm::withTitle('Test Title')
            ->withBody('Test body')
            ->withImage('https://firebase.google.com/images/social.png')
            ->withIcon('https://seeklogo.com/images/F/firebase-logo-402F407EE0-seeklogo.com.png')
            ->withSound('default')
            ->withClickAction('https://www.google.com')
            ->withPriority('high')
            ->withAdditionalData([
                'color' => '#rrggbb',
                'badge' => 0,
            ])
            ->sendNotification($this->deviceTokens);

        // Or
        return LaravelFcm::fromArray(['title' => 'Test Title', 'body' => 'Test body'])->sendNotification($this->deviceTokens);
    }

    public function sendMessage()
    {
        return LaravelFcm::withTitle('Test Title')
            ->withBody('Test body')
            ->sendMessage($this->deviceTokens);

        // Or
        return LaravelFcm::fromArray(['title' => 'Test Title', 'body' => 'Test body'])->sendMessage($this->deviceTokens);
    }
}
```

Example usage in **Notification** class:

```
use Illuminate\Notifications\Notification;
use SmirlTech\LaravelFcm\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 = [
            '{TOKEN_1}',
            '{TOKEN_2}'
        ];

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

### Tips

[](#tips)

- Check example how to receive messages or push notifications in a [JavaScript client](/javascript-client).
- You can use `laravelfcm()` helper instead of Facade.

### Payload

[](#payload)

Check how is formed payload to send to firebase:

Example 1:

```
laravelFcm::withTitle('Test Title')->withBody('Test body')->sendNotification('token1');
```

```
{
  "registration_ids": [
    "token1"
  ],
  "notification": {
    "title": "Test Title",
    "body": "Test body"
  },
  "priority": "normal"
}
```

Example 2:

```
laravelFcm::withTitle('Test Title')->withBody('Test body')->sendMessage('token1');
```

```
{
  "registration_ids": [
    "token1"
  ],
  "data": {
    "title": "Test Title",
    "body": "Test body"
  }
}
```

If you want to create payload from scratch you can use method `fromRaw`, for example:

```
return LaravelFbase::fromRaw([
    'registration_ids' => ['token1', 'token2'],
    'data' => [
        'key_1' => 'Value 1',
        'key_2' => 'Value 2'
    ],
    'android' => [
        'ttl' => '1000s',
        'priority' => 'normal',
        'notification' => [
            'key_1' => 'Value 1',
            'key_2' => 'Value 2'
        ],
    ],
])->send();
```

---

This package is a fork of [kutia-software-company/larafirebase](https://github.com/kutia-software-company/larafirebase)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 64.2% 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 ~3 days

Total

3

Last Release

983d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bb55d4ea00134836f606f459e4474d27857fe712d3b74e174dd8feb46a5207f2?d=identicon)[MarienMupenda](/maintainers/MarienMupenda)

---

Top Contributors

[![gentritabazi](https://avatars.githubusercontent.com/u/35135482?v=4)](https://github.com/gentritabazi "gentritabazi (68 commits)")[![MarienMupenda](https://avatars.githubusercontent.com/u/57844897?v=4)](https://github.com/MarienMupenda "MarienMupenda (16 commits)")[![muhamedRadwan](https://avatars.githubusercontent.com/u/16479089?v=4)](https://github.com/muhamedRadwan "muhamedRadwan (5 commits)")[![astritzeqiri](https://avatars.githubusercontent.com/u/8720176?v=4)](https://github.com/astritzeqiri "astritzeqiri (3 commits)")[![eiabea](https://avatars.githubusercontent.com/u/688128?v=4)](https://github.com/eiabea "eiabea (3 commits)")[![ferasbbm](https://avatars.githubusercontent.com/u/49439225?v=4)](https://github.com/ferasbbm "ferasbbm (3 commits)")[![samushi](https://avatars.githubusercontent.com/u/3842345?v=4)](https://github.com/samushi "samushi (2 commits)")[![HarmJan1990](https://avatars.githubusercontent.com/u/22013950?v=4)](https://github.com/HarmJan1990 "HarmJan1990 (2 commits)")[![codebeauty](https://avatars.githubusercontent.com/u/596842?v=4)](https://github.com/codebeauty "codebeauty (1 commits)")[![nathangaskin](https://avatars.githubusercontent.com/u/6713866?v=4)](https://github.com/nathangaskin "nathangaskin (1 commits)")[![oriceon](https://avatars.githubusercontent.com/u/358823?v=4)](https://github.com/oriceon "oriceon (1 commits)")[![alchalade](https://avatars.githubusercontent.com/u/9267638?v=4)](https://github.com/alchalade "alchalade (1 commits)")

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-query-builder

Easily build Eloquent queries from API requests

4.4k26.9M220](/packages/spatie-laravel-query-builder)[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[spatie/laravel-route-discovery

Auto register routes using PHP attributes

23645.0k2](/packages/spatie-laravel-route-discovery)[codedredd/laravel-soap

A SoapClient wrapper integration for Laravel

221516.6k3](/packages/codedredd-laravel-soap)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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