PHPackages                             autoxloo/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. autoxloo/fcm

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

autoxloo/fcm
============

Sends push notification via Firebase Cloud Messaging Server

1.0.0(5y ago)06.8k↓50%[1 issues](https://github.com/autoxloo/fcm/issues)1BSD-3-ClausePHPPHP &gt;=5.5.0

Since May 13Pushed 1y ago2 watchersCompare

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

READMEChangelog (1)Dependencies (2)Versions (2)Used By (1)

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

[](#firebase-cloud-messaging)

Sends push notification via Firebase Cloud Messaging Server

> Note: This package is not supported properly

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist autoxloo/fcm "*"

```

or

```
composer require --prefer-dist autoxloo/fcm "*"
```

or add

```
"autoxloo/fcm": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

To send push notification you should have private key file for your service account.

To generate a private key file for your service account:

1. In the Firebase console, open **Settings** &gt; [Service Accounts](https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk).
2. Click Generate New Private Key, and confirm by clicking Generate Key.

```
$projectId = 'autoxloo';                                        // id of your project created in firebase console
$serviceAccountFilePath = __DIR__ . '/service_account.json';    // path to your generated private key file for your service account
```

Sending push notification:

```
$fcm = new FirebaseCloudMessaging($projectId, $serviceAccountFilePath);
$response = $fcm->send($message);   // $message is instance of \autoxloo\fcm\message\Message
                                    // $response is instance of \GuzzleHttp\Psr7\Response
```

Complete example:

```
// initial data:
$projectId = 'autoxloo';
$serviceAccountFile = __DIR__ . '/service_account.json';
$token = 'some device token';
$name = 'Some name';
$title = 'Some title';
$body = 'Some body';
$data = [
    'some key1' => 'some value1',
    'some key2' => 'some value2',
];

// sending push notification:

$target = FCMFacade::createTargetToken($token);     // only target is required
$notification = FCMFacade::createNotification($title, $body);
$androidConfig = FCMFacade::createAndroidConfig([AndroidConfig::FIELD_PRIORITY => AndroidConfig::PRIORITY_HIGH]);

$message = FCMFacade::createMessage();
$message->setTarget($target)
    ->setName($name)
    ->setData($data)
    ->setNotification($notification)
    ->setAndroidConfig($androidConfig);

$fcm = new FirebaseCloudMessaging($projectId, $serviceAccountFile);
$response = $fcm->send($message);   // $response is instance of \GuzzleHttp\Psr7\Response
```

Or

```
$messageConfig = [
    // required one of: token, topic or condition
    Message::FIELD_TOKEN => $token,     // or Message::FIELD_TOPIC => $topic or Message::FIELD_CONDITION => $condition

    // not required values:
    Message::FIELD_NAME => $name,
    Message::FIELD_DATA => $data,
    Message::FIELD_NOTIFICATION => FCMFacade::createNotification($title, $body),
    Message::FIELD_ANDROID => FCMFacade::createAndroidConfig([
        AndroidConfig::FIELD_PRIORITY => AndroidConfig::PRIORITY_HIGH
   ]),
];

$message = FCMFacade::createMessage($messageConfig);

$fcm = new FirebaseCloudMessaging($projectId, $serviceAccountFile);
$response = $fcm->send($message);   // $response is instance of \GuzzleHttp\Psr7\Response
```

Target
------

[](#target)

You can use target one of:

- `TargetToken`
- `TargetTopic`
- `TargetCondition`

To create use facade:

```
$targetToken = FCMFacade::createTargetToken('some token');
$targetTopic = FCMFacade::createTargetTopic('some topic');
$targetCondition = FCMFacade::createTargetCondition('some condition');
```

See **Firebase** [Build App Server Send Requests](https://firebase.google.com/docs/cloud-messaging/send-message)for more details.

> Note: TargetCondition and TargetTopic was not tested properly.

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity50

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

Unknown

Total

1

Last Release

2188d ago

### Community

Maintainers

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

---

Top Contributors

[![VasylDmytruk](https://avatars.githubusercontent.com/u/32508794?v=4)](https://github.com/VasylDmytruk "VasylDmytruk (25 commits)")

### Embed Badge

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

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

###  Alternatives

[redjanym/php-firebase-cloud-messaging

PHP SDK for Firebase Cloud Messaging from Google

39847.9k1](/packages/redjanym-php-firebase-cloud-messaging)[devkandil/notifire

A Laravel package for sending Firebase Cloud Messaging (FCM) notifications

7510.4k](/packages/devkandil-notifire)[paxha/laravel-fcm

This package provides (Laravel Notification) channels for sending notifications via FCM (Firebase Cloud Messaging) using HTTP v1 API.

101.4k](/packages/paxha-laravel-fcm)

PHPackages © 2026

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