PHPackages                             fluxxer/larafirebase - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. fluxxer/larafirebase

ActiveLibrary[HTTP &amp; Networking](/categories/http)

fluxxer/larafirebase
====================

Laravel Firebase Cloud Messaging.

1.0.1(1y ago)02.0k↑50%MITPHP

Since Mar 13Pushed 1y agoCompare

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

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

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

 [ ![Total Downloads](https://camo.githubusercontent.com/8db1d1fd0f1778921a4d6eb8f857528b1aa6e5e30f765234c02a5e6717cb8d23/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b757469612d736f6674776172652d636f6d70616e792f6c6172616669726562617365) ](https://packagist.org/packages/kutia-software-company/larafirebase) [ ![Latest Stable Version](https://camo.githubusercontent.com/d2add87a8bcd3142965434e76594bc228c3af1eb583509eca4113e53a90b1188/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b757469612d736f6674776172652d636f6d70616e792f6c6172616669726562617365) ](https://packagist.org/packages/kutia-software-company/larafirebase) [ ![License](https://camo.githubusercontent.com/ca29e931c385db5c15e00f23e444fa2d891d284b8e327238ecea18756c140b5e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b757469612d736f6674776172652d636f6d70616e792f6c6172616669726562617365) ](https://packagist.org/packages/kutia-software-company/larafirebase)

### Introduction

[](#introduction)

**Larafirebase** 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 fluxxer/larafirebase

```

**Copy Config**

Run `php artisan vendor:publish --provider="Fluxxer\\Larafirebase\\Providers\\LarafirebaseServiceProvider"` to publish the `larafirebase.php` config file.

**Get Athentication Key**

Get Authentication Key from

**Configure larafirebase.php as needed**

```
'authentication_key' => '{AUTHENTICATION_KEY}'

```

### Usage

[](#usage)

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

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

```
use Fluxxer\Larafirebase\Facades\Larafirebase;

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

    public function sendNotification()
    {
        return Larafirebase::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 Larafirebase::fromArray(['title' => 'Test Title', 'body' => 'Test body'])->sendNotification($this->deviceTokens);
    }

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

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

Example usage in **Notification** class:

```
use Illuminate\Notifications\Notification;
use Fluxxer\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 = [
            '{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 `larafirebase()` helper instead of Facade.

### Payload

[](#payload)

Check how is formed payload to send to firebase:

Example 1:

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

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

Example 2:

```
Larafirebase::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 Larafirebase::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();
```

---

Made with ♥ by Gentrit Abazi ([@gentritabazi](https://github.com/gentritabazi)).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance45

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 72% 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 ~0 days

Total

2

Last Release

423d ago

### Community

Maintainers

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

---

Top Contributors

[![gentritabazi](https://avatars.githubusercontent.com/u/35135482?v=4)](https://github.com/gentritabazi "gentritabazi (72 commits)")[![muhamedRadwan](https://avatars.githubusercontent.com/u/16479089?v=4)](https://github.com/muhamedRadwan "muhamedRadwan (5 commits)")[![joaomarcosfluxxer](https://avatars.githubusercontent.com/u/127209074?v=4)](https://github.com/joaomarcosfluxxer "joaomarcosfluxxer (4 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)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![anggerpputro](https://avatars.githubusercontent.com/u/21016176?v=4)](https://github.com/anggerpputro "anggerpputro (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)")

### Embed Badge

![Health badge](/badges/fluxxer-larafirebase/health.svg)

```
[![Health](https://phpackages.com/badges/fluxxer-larafirebase/health.svg)](https://phpackages.com/packages/fluxxer-larafirebase)
```

###  Alternatives

[danharrin/livewire-rate-limiting

Apply rate limiters to Laravel Livewire actions.

40423.1M27](/packages/danharrin-livewire-rate-limiting)[mateusjunges/laravel-kafka

A kafka driver for laravel

7163.1M17](/packages/mateusjunges-laravel-kafka)[ricorocks-digital-agency/soap

A SOAP client that provides a clean interface for handling requests and responses.

4281.8M5](/packages/ricorocks-digital-agency-soap)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[laravel-shift/curl-converter

A command line tool to convert curl requests to Laravel HTTP requests.

935.3k](/packages/laravel-shift-curl-converter)[illuminatech/data-provider

Allows easy build for DB queries from API requests

4413.3k](/packages/illuminatech-data-provider)

PHPackages © 2026

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