PHPackages                             maatify/google-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. maatify/google-fcm

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

maatify/google-fcm
==================

Unofficial Firebase Admin SDK for PHP its PHP library for maatify.dev FCM handler, known by our team

5.0.1(9mo ago)080proprietaryPHP

Since Jul 26Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/Maatify/google-fcm)[ Packagist](https://packagist.org/packages/maatify/google-fcm)[ Docs](https://github.com/Maatify/)[ RSS](/packages/maatify-google-fcm/feed)WikiDiscussions main Synced 1mo ago

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

[![Current version](https://camo.githubusercontent.com/13792d2a8d64580ed5b79f4a027c24073b584e8b8c791e181fa5e0f3a1018da1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6161746966792f676f6f676c652d66636d)](https://packagist.org/packages/maatify/google-fcm)[![Packagist PHP Version Support](https://camo.githubusercontent.com/a0188f2b27a2b805e3945bf16b13d9ca454fa972c07a6dede89fb9f21e4957b5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6d6161746966792f676f6f676c652d66636d)](https://packagist.org/packages/maatify/google-fcm)[![Monthly Downloads](https://camo.githubusercontent.com/6e355fd2639ffc9021d7a8b7a4c04b3bf93c217406c079f3194620cec2c4b55b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d6161746966792f676f6f676c652d66636d)](https://packagist.org/packages/maatify/google-fcm/stats)[![Total Downloads](https://camo.githubusercontent.com/c71807c232645f38f4be26b3acda20723182e5eb59cfa1edbdc2595871512079/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6161746966792f676f6f676c652d66636d)](https://packagist.org/packages/maatify/google-fcm/stats)[![Stars](https://camo.githubusercontent.com/d03a629051fbea8e2ab1c516c687ab7fba15a2d934d6d92c56f175169c4def92/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6d6161746966792f676f6f676c652d66636d)](https://github.com/maatify/google-fcm/stargazers)

About
=====

[](#about)

> Note:
>
> This Library is smiller to kreait/firebase-php
>
> View kreait/firebase-php [Docs](https://firebase-php.readthedocs.io/en/stable/cloud-messaging.html)
>
> View kreait/firebase-php on [GitHub](https://github.com/kreait/firebase-php)

Installation
============

[](#installation)

```
composer require maatify/google-fcm
```

Usage
=====

[](#usage)

### Project Instance

[](#project-instance)

```
use Maatify\FCM\FcmHandler;

require __DIR__ . '/vendor/autoload.php';

$message = new FcmHandler(__credentials_json_file_location__);
```

> Note: $message will use in whole project handler

Message Preparing and Send
--------------------------

[](#message-preparing-and-send)

### Notification Setter For FCM

[](#notification-setter-for-fcm)

```
// Optional
$message->SetNotification('My Custom Title', 'My Custom Body', __image_url__ = '');
```

### Data Setter For FCM

[](#data-setter-for-fcm)

```
// Optional
$message->SetDate([
        'key1'=>'value1',
        'key2'=>'value2',
    ]);
```

### Send FCM To Device Token

[](#send-fcm-to-device-token)

```
try {
    // $message->sender cannot callable before setting at least one of optional setter
    $result = $message->sender->ToDeviceToken(__device_token__);

} catch (MessagingException|FirebaseException $e) {

    $result = (array) $e;
}

print_r($result);
```

### Send FCM To Multiple Devices Token

[](#send-fcm-to-multiple-devices-token)

```
// $message->sender cannot callable before setting at least one of optional setter
$result = $message->sender->ToMultipleDevicesToken([__device_token1__, __device_token2__]);

print_r($result);
```

### Send FCM To Topic

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

```
try {
    // $message->sender cannot callable before setting at least one of optional setter
    $result = $message->sender->ToTopic(__topic__);

} catch (MessagingException|FirebaseException $e) {

    $result = (array) $e;
}

print_r($result);
```

Topic Validate
--------------

[](#topic-validate)

If you have a set of registration tokens that you want to check for validity or if they are still registered to your project, you can use the validateTokens() method:

### Topic Validation

[](#topic-validation)

```
try {

    $tokens = [__device_token__]; // to validate one token only
    $result = $message->TopicValidation()->ValidateRegistrationTokens($tokens);

} catch (MessagingException|FirebaseException $e) {

    $result = (array) $e;
}

print_r($result);
```

### Topics Validation

[](#topics-validation)

```
try {

    $tokens = [__device_token1__, __device_token2__]; // to validate many tokens
    $result = $message->TopicValidation()->ValidateRegistrationTokens($tokens);

} catch (MessagingException|FirebaseException $e) {

    $result = (array) $e;
}

print_r($result);
```

> Note:
>
> - `valid` contains all tokens that are valid and registered to the current Firebase project
> - `unknown` contains all tokens that are valid, but not registered to the current Firebase project
> - `invalid` contains all invalid (=malformed) tokens

Topic Management
----------------

[](#topic-management)

You can subscribe one or multiple devices to one or multiple messaging topics with the following methods:

### Topic Instance

[](#topic-instance)

```
$topic_manager = $message->TopicManagement();
```

> Note: for all Topic Management
>
> - `$registrationTokenOrTokens` can be string if one token or array if many tokens ```
>     $registrationTokenOrTokens = __device_token__;
>     // or
>     $registrationTokenOrTokens = [__device_token1__, __device_token2__];
>     ```
> - `$topic` is device token in string ```
>     $topic = 'topic-a';
>     ```
> - `$topics` is devices tokens in array ```
>     $topics = ['topic-a', 'topic-b'];
>     ```

### Subscribe To Topic

[](#subscribe-to-topic)

```
$result = $topic_manager->SubscribeToTopic($topic, $registrationTokenOrTokens);

print_r($result);
```

### Subscribe To Topics

[](#subscribe-to-topics)

```
$result = $topic_manager->SubscribeToTopics($topics, registrationTokenOrTokens);

print_r($result);
```

### Unsubscribe From Topic

[](#unsubscribe-from-topic)

```
$result = $topic_manager->UnsubscribeFromTopic($topic, $registrationTokenOrTokens);

print_r($result);
```

### Unsubscribe From Topics

[](#unsubscribe-from-topics)

```
$result = $topic_manager->SubscribeToTopics($topics, registrationTokenOrTokens);

print_r($result);
```

### Unsubscribe From All Topics

[](#unsubscribe-from-all-topics)

```
$result = $topic_manager->UnsubscribeFromAllTopics(registrationTokenOrTokens);

print_r($result);
```

The result will return an array win which the keys are the topic names, and the values are the operation results for the individual tokens.

> Note:
>
> You can subscribe up to 1,000 devices in a single request. If you provide an array with over 1,000 registration tokens, the operation will fail with an error.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance58

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

Total

3

Last Release

274d ago

Major Versions

1.1.1 → 5.0.12025-08-10

### Community

Maintainers

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

---

Top Contributors

[![megyptm](https://avatars.githubusercontent.com/u/33574895?v=4)](https://github.com/megyptm "megyptm (12 commits)")

---

Tags

phpFCMhandler

### Embed Badge

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

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

PHPackages © 2026

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