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

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

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

PHP application server for google firebase cloud messaging (FCM)

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

Since Dec 8Pushed 2y 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 2w 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

28

—

LowBetter than 51% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

750d 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

[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

36826.2k2](/packages/telnyx-telnyx-php)[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k29.9M347](/packages/openai-php-client)[getbrevo/brevo-php

Official PHP SDK for the Brevo API.

1004.1M59](/packages/getbrevo-brevo-php)[anthropic-ai/sdk

Anthropic PHP SDK

174884.4k25](/packages/anthropic-ai-sdk)[n1ebieski/ksef-php-client

PHP API client that allows you to interact with the API Krajowego Systemu e-Faktur

9082.3k](/packages/n1ebieski-ksef-php-client)[shopware/app-php-sdk

Shopware App SDK for PHP

15120.5k3](/packages/shopware-app-php-sdk)

PHPackages © 2026

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