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

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

ruslanmedia/php-fcm
===================

PHP API for Firebase Cloud Messaging from Google

v1.1.5(6y ago)14501MITPHPPHP &gt;=5.5

Since Feb 25Pushed 6y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (3)Versions (9)Used By (0)

PHP Firebase Cloud Messaging
============================

[](#php-firebase-cloud-messaging)

PHP API for Firebase Cloud Messaging from Google.

Currently this app server library only supports sending Messages/Notifications via HTTP.

See original Firebase docs:

\#Setup Install via Composer:

```
composer require ruslanmedia/php-fcm

```

Or add this to your composer.json and run "composer update":

```
"require": {
    "ruslanmedia/php-fcm": "1.*"
}

```

Send message to **one or multiple** Devices
===========================================

[](#send-message-to-one-or-multiple-devices)

```
use sngrl\PhpFirebaseCloudMessaging\Client;
use sngrl\PhpFirebaseCloudMessaging\Message;
use sngrl\PhpFirebaseCloudMessaging\Recipient\Device;
use sngrl\PhpFirebaseCloudMessaging\Notification;

$server_key = '_YOUR_SERVER_KEY_';
$client = new Client();
$client->setApiKey($server_key);

$message = new Message();
$message->setPriority('high');
$message->addRecipient(new Device('_YOUR_DEVICE_TOKEN_'));
$message
    ->setNotification(new Notification('some title', 'some body'))
    ->setData(['key' => 'value'])
;

$response = $client->send($message);
var_dump($response->getStatusCode());
var_dump($response->getBody()->getContents());

```

Send message to Topic
=====================

[](#send-message-to-topic)

Currently sending to topics only supports a single topic as recipient. Mutliple topic as outlined in the google docs don't seem to work, yet.

```
use sngrl\PhpFirebaseCloudMessaging\Client;
use sngrl\PhpFirebaseCloudMessaging\Message;
use sngrl\PhpFirebaseCloudMessaging\Recipient\Topic;
use sngrl\PhpFirebaseCloudMessaging\Notification;

$server_key = '_YOUR_SERVER_KEY_';
$client = new Client();
$client->setApiKey($server_key);

$message = new Message();
$message->setPriority('high');
$message->addRecipient(new Topic('_YOUR_TOPIC_'));
$message
    ->setNotification(new Notification('some title', 'some body'))
    ->setData(['key' => 'value'])
;

$response = $client->send($message);
var_dump($response->getStatusCode());
var_dump($response->getBody()->getContents());

```

Subscribe user to the topic
===========================

[](#subscribe-user-to-the-topic)

```
use sngrl\PhpFirebaseCloudMessaging\Client;

$server_key = '_YOUR_SERVER_KEY_';
$client = new Client();
$client->setApiKey($server_key);

$response = $client->addTopicSubscription('_SOME_TOPIC_ID_', ['_FIRST_TOKEN_', '_SECOND_TOKEN_']);
var_dump($response->getStatusCode());
var_dump($response->getBody()->getContents());

```

Remove user subscription to the topic
=====================================

[](#remove-user-subscription-to-the-topic)

```
use sngrl\PhpFirebaseCloudMessaging\Client;

$server_key = '_YOUR_SERVER_KEY_';
$client = new Client();
$client->setApiKey($server_key);

$response = $client->removeTopicSubscription('_SOME_TOPIC_ID_', ['_FIRST_TOKEN_', '_SECOND_TOKEN_']);
var_dump($response->getStatusCode());
var_dump($response->getBody()->getContents());

```

Interpreting responses
======================

[](#interpreting-responses)

Responses given on the HTTP requests are standard according to the FCM documentations. You may find detailed specifications in this links:

-
-

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 60% 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 ~150 days

Recently: every ~209 days

Total

7

Last Release

2465d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5573740?v=4)[Ruslan Rustamov](/maintainers/ruslanmedia)[@ruslanmedia](https://github.com/ruslanmedia)

---

Top Contributors

[![redjanym](https://avatars.githubusercontent.com/u/15679866?v=4)](https://github.com/redjanym "redjanym (21 commits)")[![sngrl](https://avatars.githubusercontent.com/u/6196684?v=4)](https://github.com/sngrl "sngrl (10 commits)")[![buryni](https://avatars.githubusercontent.com/u/172052?v=4)](https://github.com/buryni "buryni (1 commits)")[![johann59](https://avatars.githubusercontent.com/u/9280133?v=4)](https://github.com/johann59 "johann59 (1 commits)")[![kmarques](https://avatars.githubusercontent.com/u/7290607?v=4)](https://github.com/kmarques "kmarques (1 commits)")[![ruslanmedia](https://avatars.githubusercontent.com/u/5573740?v=4)](https://github.com/ruslanmedia "ruslanmedia (1 commits)")

---

Tags

phpcloudgooglenotificationsfirebaseFCMchromeandroidios

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ruslanmedia-php-fcm/health.svg)

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

###  Alternatives

[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)[redjanym/php-firebase-cloud-messaging

PHP SDK for Firebase Cloud Messaging from Google

39847.9k1](/packages/redjanym-php-firebase-cloud-messaging)[paragraph1/php-fcm

PHP application server for google firebase cloud messaging (FCM)

1991.2M10](/packages/paragraph1-php-fcm)[kedniko/firebase-cloud-messaging-http-v1-php

Firebase cloud messaging http v1 php

124.8k](/packages/kedniko-firebase-cloud-messaging-http-v1-php)[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)[bentools/webpush-bundle

Send push notifications through Web Push Protocol to your Symfony users.

71274.3k](/packages/bentools-webpush-bundle)

PHPackages © 2026

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