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

ActiveLibrary

erickskrauch/fcm
================

PHP application server for google firebase cloud messaging (FCM)

0.3.0(1y ago)027.8k—7.1%[1 issues](https://github.com/erickskrauch/fcm/issues)MITPHPPHP ^7.4 || ^8.0

Since Dec 8Pushed 1y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (16)Versions (5)Used By (0)

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

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

Just another client to send push notifications via Firebase Cloud Messaging (FCM). The implementation is inspired by [Paragraph1/php-fcm](https://github.com/Paragraph1/php-fcm) and its fork [guigpm/php-fcm](https://github.com/guigpm/php-fcm), but heavily reworked in favor of simpler code and better implementation.

[![Latest Version on Packagist](https://camo.githubusercontent.com/0ee730c98ea29f3c20985ded3a8a200abdc84f76e4ec59b4b52827200e732f66/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f657269636b736b72617563682f66636d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/erickskrauch/fcm)[![Build Status](https://camo.githubusercontent.com/1d8c98b02339ef017ae009cbb53a05bfabd687909ba8b644bdea1b0fdec12796/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f657269636b736b72617563682f66636d2f63692e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/erickskrauch/fcm/actions)[![Changelog](https://camo.githubusercontent.com/f682e0d1ff9dd815b94c09f7c45da9d98e44e51b15a0cbefee06930b4f0c0490/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6368616e67656c6f672d4b656570253230612532304368616e67656c6f672d2532334530353733353f7374796c653d666c61742d737175617265)](CHANGELOG.md)[![PHP version](https://camo.githubusercontent.com/85d86d358800b000f1d0fa49e12ac98ff2b7cf86e51ecea00f7eba6a1d7d2162/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f657269636b736b72617563682f66636d2f7068703f7374796c653d666c61742d737175617265)](composer.json)[![Software License](https://camo.githubusercontent.com/6c711032aff1ca0eb6b211aa6cb3649ce7fd64a7714e1181d4bb457f9680e7cf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

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

[](#installation)

This library relies on [PSR-18](https://www.php-fig.org/psr/psr-18/) which defines how HTTP message should be sent and received. You can use any library to send HTTP messages that implements [psr/http-client-implementation](https://packagist.org/providers/psr/http-client-implementation). Read more about PSR-18 in [this blog](https://www.php-fig.org/blog/2018/11/psr-18-the-php-standard-for-http-clients/).

To install this library with [Guzzle](https://packagist.org/packages/guzzlehttp/guzzle) you may run the following command:

```
composer require erickskrauch/fcm guzzlehttp/guzzle
```

Or using the [curl client](https://packagist.org/packages/php-http/curl-client) (you'll need to provide a [PSR7](https://www.php-fig.org/psr/psr-7/) implementation such as [nyholm/psr7](https://packagist.org/packages/nyholm/psr7) if not using Guzzle):

```
composer require erickskrauch/fcm php-http/curl-client nyholm/psr7
```

Usage
-----

[](#usage)

The component's constructor allows you to explicitly pass all dependencies. But you can also pass only the mandatory API token, and all other dependencies will be found automatically. The example below relies on [auto discovery](https://docs.php-http.org/en/latest/discovery.html).

```
use ErickSkrauch\Fcm\Client;
use ErickSkrauch\Fcm\Message\Message;
use ErickSkrauch\Fcm\Message\Notification;
use ErickSkrauch\Fcm\Recipient\Device;

$client = new Client('SERVICE ACCOUNT OAUTH TOKEN', 'project-x146w');

$notification = new Notification(, 'testing body');
$notification->setTitle('Wow, something happened...');
$notification->setBody('It just works!');

$message = new Message();
$message->setNotification($notification);
$message->setCollapseKey('collapse.key');

$recipient = new Device('your-device-token'); // or new ErickSkrauch\Fcm\Recipient\Topic('topic');

$result = $client->send($message, $recipient);
```

Contribute
----------

[](#contribute)

This library in an Open Source under the MIT license. It is, thus, maintained by collaborators and contributors.

Feel free to contribute in any way. As an example you may:

- Trying out the `master` code.
- Create issues if you find problems.
- Reply to other people's issues.
- Review PRs.

### Ensuring code quality

[](#ensuring-code-quality)

The project has several tools for quality control. All checks are performed in CI, but if you want to perform checks locally, here are the necessary commands:

```
vendor/bin/php-cs-fixer fix -v
vendor/bin/phpstan analyse
vendor/bin/phpunit
vendor/bin/infection # Try "env XDEBUG_MODE=coverage vendor/bin/infection" in case of errors
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance33

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

Total

4

Last Release

658d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4787256?v=4)[ErickSkrauch](/maintainers/ErickSkrauch)[@erickskrauch](https://github.com/erickskrauch)

---

Top Contributors

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

---

Tags

googlenotificationsgcmfirebaseFCMandroidiosFirebase Cloud Messaging

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[paragraph1/php-fcm

PHP application server for google firebase cloud messaging (FCM)

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

PHP Client for OpenSearch

15224.3M65](/packages/opensearch-project-opensearch-php)[kedniko/firebase-cloud-messaging-http-v1-php

Firebase cloud messaging http v1 php

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

Official Brevo provided RESTFul API V3 php library

963.1M35](/packages/getbrevo-brevo-php)

PHPackages © 2026

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