PHPackages                             peterujah/php-firebase-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. [Mail &amp; Notifications](/categories/mail)
4. /
5. peterujah/php-firebase-notification

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

peterujah/php-firebase-notification
===================================

Send firebase device push notification from php curl.

1.2(4y ago)3191MITPHPPHP ^7.0 || ^8.0

Since May 7Pushed 4y ago1 watchersCompare

[ Source](https://github.com/peterujah/php-firebase-notification)[ Packagist](https://packagist.org/packages/peterujah/php-firebase-notification)[ RSS](/packages/peterujah-php-firebase-notification/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

A simple php class to help you send firebase push notification from php curl. It will allow you to push cloud messaging through firebase in 3 different way.

1. Send to a single device id
2. Send to a multiple device ids
3. Send to a specific topic subscribers

Installation

Installation is super-easy via Composer:

```
composer require peterujah/php-firebase-notification
```

initialize the firebase class with your google api key

```
use Peterujah\NanoBlock\FirebaseServiceModel;
use Peterujah\NanoBlock\FirebaseService;

define("GOOGLE_FCM_API_KEY", "AAAAtXpvsYU:APXXX");
$model = new FirebaseServiceModel();
$service = new FirebaseService(GOOGLE_FCM_API_KEY);
```

Sending a message to a single device id can be done like this.

```
$model->setTo("f-bbVq2uCgY:APA91bF0s7jk5lXXy");
$model->setTitle("I code it here");
$model->setMessage("Will you like to join us?");
$response = $service->notify($model);
var_export($response);
```

Sending a message to a multiple user IDs can be done like this

```
$model->setTo(array("User-A", "User-B", "User-C"));
$model->setTitle("I code it here");
$model->setMessage("Will you like to join us?");
$response = $service->notify($model);
var_export($response);
```

Sending a message by topic IDs/name can be done like this

```
$model->setIsTopic(FirebaseServiceModel::TOPIC);
$model->setTo("TOPIC_GROUP_ID_NAME");
$model->setTitle("I code it here");
$model->setMessage("Will you like to join us?");
$response = $service->notify($model);
var_export($response);
```

Methods

Set the notification payload node type. The default is `FirebaseServiceModel::NODE_NOTIFICATION`

```
$model->setNode(FirebaseServiceModel::NODE_NOTIFICATION | FirebaseServiceModel::NODE_DATA);
```

Sets the notification to send to topic. The default is `false`, pass `FirebaseServiceModel::TOPIC` or `true`, to enable topic.

```
$model->setIsTopic(FirebaseServiceModel::TOPIC);
```

Sets the notification body, default is message

```
$model->setBody($body);
```

Sets the notification image url.

```
$model->setImage("https://img.com/path/to/foo.png");
```

Sets the notification click action for android.

```
$model->setClickAction($click);
```

Sets the notification refernce for custom use.

```
$model->setReference($ref);
```

Sets the notification additional meta data for custom use.

```
$model->setMeta($array);
```

Sets the notification badge id.

```
$model->setBadge($int);
```

Sets the notification background state.

```
$model->setIsBackground($bool);
```

Sets the notification sound type.

```
$model->setSound($sound);
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 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 ~6 days

Total

2

Last Release

1466d ago

### Community

Maintainers

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

---

Top Contributors

[![peterujah](https://avatars.githubusercontent.com/u/16369609?v=4)](https://github.com/peterujah "peterujah (26 commits)")

---

Tags

googlelibraryclassfirebaseFCMpush notificationphp notificationphp push notifications

### Embed Badge

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

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

###  Alternatives

[paragraph1/php-fcm

PHP application server for google firebase cloud messaging (FCM)

1991.2M10](/packages/paragraph1-php-fcm)[edwinhoksberg/php-fcm

A library for sending Firebase cloud messages and managing user topic subscriptions, device groups and devices.

68328.5k1](/packages/edwinhoksberg-php-fcm)[redjanym/php-firebase-cloud-messaging

PHP SDK for Firebase Cloud Messaging from Google

39847.9k1](/packages/redjanym-php-firebase-cloud-messaging)[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)[kedniko/firebase-cloud-messaging-http-v1-php

Firebase cloud messaging http v1 php

124.8k](/packages/kedniko-firebase-cloud-messaging-http-v1-php)[liliom/laravel-firebase

Laravel FCM (Firebase Cloud Messaging) Notification Channel

2426.1k](/packages/liliom-laravel-firebase)

PHPackages © 2026

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