PHPackages                             open-php/firebase-fcm-notification - 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. open-php/firebase-fcm-notification

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

open-php/firebase-fcm-notification
==================================

A robust PHP library for sending Firebase Cloud Messaging (FCM) notifications using the HTTP v1 API. Features include simple access token management, topic messaging, and support for rich notifications with images.

V1.0.1(3mo ago)04MITPHPPHP &gt;=7.4

Since Jan 19Pushed 3mo agoCompare

[ Source](https://github.com/mrsandipmandal/firebaseNotification)[ Packagist](https://packagist.org/packages/open-php/firebase-fcm-notification)[ Docs](https://github.com/mrsandipmandal/firebaseNotification)[ RSS](/packages/open-php-firebase-fcm-notification/feed)WikiDiscussions master Synced 1mo ago

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

Firebase FCM Notification Library (PHP)
=======================================

[](#firebase-fcm-notification-library-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/935ebabcf4be9ae0e722f46d3ce85b06875329a66a09c914c0237d922045b4af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f70656e2d7068702f66697265626173652d66636d2d6e6f74696669636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/open-php/firebase-fcm-notification)[![Total Downloads](https://camo.githubusercontent.com/b4de8e7ca38ab760a47ef3f6de6e47b3c091cfabae90e436e614dca47a2cfc34/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f70656e2d7068702f66697265626173652d66636d2d6e6f74696669636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/open-php/firebase-fcm-notification)[![License](https://camo.githubusercontent.com/3d8703176fc12694a8614cb27d4cb0bbcf3fffdfea3a4138a22c17814904f3d0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f70656e2d7068702f66697265626173652d66636d2d6e6f74696669636174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/open-php/firebase-fcm-notification)

A robust and easy-to-use PHP library for sending Firebase Cloud Messaging (FCM) notifications using the Google HTTP v1 API.

This library encapsulates the complexity of generating JWT tokens for Google Auth and making requests to the FCM v1 API.

Features
--------

[](#features)

- **HTTP v1 API Support**: Uses the latest Firebase v1 API.
- **Service Account Authentication**: handled automatically via `service_account.json`.
- **Flexible Targeting**: Support for sending to specific device tokens or topics.
- **Rich Notifications**: Support for title, body, and image.
- **PSR-4 Autoloading**: Easy integration with Composer.

Folder Structure
----------------

[](#folder-structure)

```
firebase-fcm-notification/
├── src/
│   └── FcmNotification.php  send($title, $body, $token);

    print_r($result);

} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}
```

### Advanced Usage (Topics &amp; Images)

[](#advanced-usage-topics--images)

```
// Send to a topic
$isTopic = true;
$target = "news"; // Topic name
$imageUrl = "https://example.com/image.png";

$result = $fcm->send($title, $body, $target, $isTopic, $imageUrl);
```

Class &amp; Methods
-------------------

[](#class--methods)

### `OpenPhp\FirebaseFcm\FcmNotification`

[](#openphpfirebasefcmfcmnotification)

#### `__construct($serviceAccount)`

[](#__constructserviceaccount)

Initializes the FCM client.

- **$serviceAccount** *(string|array)*: Path to the `service_account.json` file OR an associative array containing the JSON data.

#### `send($title, $body, $target, $isTopic = false, $imageUrl = null)`

[](#sendtitle-body-target-istopic--false-imageurl--null)

Sends a notification.

- **$title** *(string)*: Notification title.
- **$body** *(string)*: Notification body text.
- **$target** *(string)*: Device registration token OR topic name.
- **$isTopic** *(bool)*: Set to `true` if `$target` is a topic name. Default `false`.
- **$imageUrl** *(string|null)*: Optional URL to an image to display in the notification.
- **Returns**: `array` (FCM API response) or `['error' => string]` on failure.

Support
-------

[](#support)

- **Issues**: [GitHub Issues](https://github.com/mrsandipmandal/firebaseNotification/issues)
- **Source**: [GitHub Repository](https://github.com/mrsandipmandal/firebaseNotification)

License
-------

[](#license)

This project is licensed under the MIT License. See [LICENSE](LICENSE) file for details.

Author
------

[](#author)

- **Sandip Mandal** - [GitHub](https://github.com/mrsandipmandal)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance78

Regular maintenance activity

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

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

Every ~0 days

Total

2

Last Release

119d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1cfba1cdaaab95e40cfe363c3cd258c77ab78c5bf3fc26112e4b7a8d971565b5?d=identicon)[mrsandipmandal](/maintainers/mrsandipmandal)

---

Top Contributors

[![mrsandipmandal](https://avatars.githubusercontent.com/u/75414705?v=4)](https://github.com/mrsandipmandal "mrsandipmandal (3 commits)")

---

Tags

phpwebGuzzlenotificationfirebaseFCMoauth2push notificationgoogle apiandroidioscloud-messaging

### Embed Badge

![Health badge](/badges/open-php-firebase-fcm-notification/health.svg)

```
[![Health](https://phpackages.com/badges/open-php-firebase-fcm-notification/health.svg)](https://phpackages.com/packages/open-php-firebase-fcm-notification)
```

###  Alternatives

[paragraph1/php-fcm

PHP application server for google firebase cloud messaging (FCM)

1991.2M10](/packages/paragraph1-php-fcm)[redjanym/php-firebase-cloud-messaging

PHP SDK for Firebase Cloud Messaging from Google

39847.9k1](/packages/redjanym-php-firebase-cloud-messaging)[xeroapi/xero-php-oauth2

Xero official PHP SDK for oAuth2 generated with OpenAPI spec 3

1054.3M14](/packages/xeroapi-xero-php-oauth2)[kedniko/firebase-cloud-messaging-http-v1-php

Firebase cloud messaging http v1 php

124.8k](/packages/kedniko-firebase-cloud-messaging-http-v1-php)[redjanym/fcm-bundle

A Symfony Bundle for projects to send notifications in mobile devices through Firebase Cloud Messaging HTTP V1 API

43453.0k](/packages/redjanym-fcm-bundle)[coder966/fcm-simple

PHP library for Firebase Cloud Messaging

131.2k](/packages/coder966-fcm-simple)

PHPackages © 2026

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