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

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

warith/laravel-fcm-httpv1
=========================

A Laravel package to send Firebase Cloud Messaging (FCM) notifications across Laravel applications.

0.0.1(8mo ago)03MITPHPPHP ^7.4|^8.0

Since Aug 16Pushed 8mo agoCompare

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

READMEChangelogDependencies (1)Versions (2)Used By (0)

Laravel FCM HTTP v1 🚀✨🔥
=======================

[](#laravel-fcm-http-v1-)

A simple package that helps you send **Firebase notifications using HTTP v1** with your Laravel applications. 🎯📬💡

---

### Installation 📦⚡️💻

[](#installation-️)

You can install the package via composer: 🎉📥🛠️

```
composer require warith313/laravel-fcm-httpv1 "^0.0.1"
```

---

### Laravel Setup 🛠️📣🚀

[](#laravel-setup-️)

Register the service provider: 🏗️📢💡

```
// config/app.php

'providers' => [
    // ...
    Warith\Fcm\FcmServiceProvider::class,
],
```

Optional: add the Facade for easy access: 🪄📘✨

```
// config/app.php

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

Publish the config file: 📂📣💼

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

Published file content (`config/laravel-fcm.php`): 📝📌🔧

```
return [

    /**
     * Path to your Firebase service account JSON file
     */
    'service_account_path' => env('FCM_SERVICE_ACCOUNT_PATH', storage_path('app/service-account.json')),

];
```

Set the path in your `.env`: 🌟📁📝

```
FCM_SERVICE_ACCOUNT_PATH=/storage/app/service-account.json

```

---

### Lumen Setup 🔧📡⚡️

[](#lumen-setup-️)

Add the service provider in `bootstrap/app.php`: 🏗️💡🚀

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

Copy the config file to `config/laravel-fcm.php` and configure before registering the provider: 📝⚙️📂

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

---

### Methods Reference 📜⚙️📝

[](#methods-reference-️)

- `->to($recipients)` – Send to a single token (string) or array of tokens
- `->toTopic($topic)` – Send to a topic
- `->data($array)` – Custom data payload
- `->notification($array)` – Notification payload
- `->priority('high'|'normal')` – Notification priority
- `->timeToLive(seconds)` – Time to live in seconds (0 to 2419200)
- `->enableResponseLog()` – Log raw Firebase response
- `->send()` – Send the message

---

### Usage Examples 📬🔥🎯

[](#usage-examples-)

#### 1. Send only data payload: 📊🖋️⚡️

[](#1-send-only-data-payload-️️)

```
$recipients = [
    'token1...',
    'token2...',
];

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

#### 2. Send to a topic: 📢📰🎯

[](#2-send-to-a-topic-)

```
$topic = 'news';

fcm()
    ->toTopic($topic)
    ->priority('normal')
    ->timeToLive(0)
    ->notification([
        'title' => 'Topic FCM',
        'body' => 'This is a topic test',
    ])
    ->send();
```

#### 3. Send only notification payload: 🔔📝✨

[](#3-send-only-notification-payload-)

```
fcm()
    ->to($recipients)
    ->priority('high')
    ->timeToLive(0)
    ->notification([
        'title' => 'Test Notification',
        'body' => 'Notification only payload',
    ])
    ->send();
```

#### 4. Send both data &amp; notification payloads with image 🖼️📱🌟

[](#4-send-both-data--notification-payloads-with-image-️)

```
fcm()
    ->to($recipients)
    ->priority('high')
    ->timeToLive(0)
    ->data([
        'title' => 'Test FCM',
        'body' => 'This is a data payload',
        'type' => 'all',
        'click_action' => 'FLUTTER_NOTIFICATION_CLICK',
        'image' => $image_link
    ])
    ->notification([
        'title' => 'Test FCM',
        'body' => 'This is a notification payload',
        'image' => $image_link
    ])
    ->send();
```

> **Note:** When sending images, the package automatically sets `mutable-content` for APNs, adds image to Android notification, and includes Webpush headers. 📷📲🎨

---

### Logging 📝🔍📂

[](#logging-)

To see the raw Firebase response: 🖥️📋✨

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

Check logs at `storage/logs/laravel.log`. 🗂️📜🔥

---

### Notes for HTTP v1 ⚡️🚀💡

[](#notes-for-http-v1-️)

- `token` must be a single string per message. For multiple tokens, pass an array to `->to($tokens)` and the package sends each individually.
- APNs overrides (`badge`, `mutable-content`) are automatically added if `image` is provided.
- Android overrides (`click_action`, `image`) are automatically handled.
- Webpush image headers are automatically added if `image` is present.
- `timeToLive` must be between `0` and `2419200` (28 days). 🎯📬📌

---

### License 🔒

[](#license-)

This package is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance58

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

269d ago

### Community

Maintainers

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

---

Top Contributors

[![warith313](https://avatars.githubusercontent.com/u/22943579?v=4)](https://github.com/warith313 "warith313 (1 commits)")

---

Tags

fcmfcm-httpfcm-messagingfcm-notificationsfcm-push-notificationlaravellaravel-packagelaravelpushnotificationfirebaseFCM

### Embed Badge

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

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

PHPackages © 2026

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