PHPackages                             talalm/php-fcm-wrapper - 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. [API Development](/categories/api)
4. /
5. talalm/php-fcm-wrapper

ActiveLibrary[API Development](/categories/api)

talalm/php-fcm-wrapper
======================

PHP wrapper for FCM

022.9k2[1 issues](https://github.com/TalalM/php-fcm-wrapper/issues)PHP

Since Jul 10Pushed 8y ago1 watchersCompare

[ Source](https://github.com/TalalM/php-fcm-wrapper)[ Packagist](https://packagist.org/packages/talalm/php-fcm-wrapper)[ RSS](/packages/talalm-php-fcm-wrapper/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

php-fcm-wrapper
===============

[](#php-fcm-wrapper)

PHP Wrapper for the FCM API

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

[](#installation)

You can install the wrapper using [Composer](http://getcomposer.org/doc/00-intro.md):

```
composer require talalm/php-fcm-wrapper

```

Usage
-----

[](#usage)

Using the wrapper is pretty straightforward.

The first thing you need to do is create a client with your API key

```
$client = new FCM\Client("YOUR_API_KEY");

```

### Send a simple notification

[](#send-a-simple-notification)

The tokens are put in an array on the **registration\_ids** parameter.

And the notification title is put in the parameter **notification.body\_loc\_key**

Example:

```
$client->send([
    'registration_ids' => ['token1', 'token2', ...],
    'notification' => ['body_loc_key' => 'This is a notification sent via php-fcm-wrapper']
]);

```

### Add notification parameters

[](#add-notification-parameters)

You can add additional parameters to the notification :

- The **badge** value (defaults to 1)
- The **sound** value (defaults to 'notif.caf')

Example:

```
$client->send([
    'registration_ids' => ['token1', 'token2', ...],
    'notification' => ['body_loc_key' => 'This is a revolution',
    				   'badge' => 1789
    				   'sound' => 'la-marseillaise.caf'],
]);

```

### Additional data

[](#additional-data)

Also, if you have additional data that you want to add to your notification, just add it to the **data** parameter

```
$client->send([
    'registration_ids' => ['token1', 'token2', ...],
    'notification' => ['body_loc_key' => 'This is a revolution',
    				   'badge' => 1789
    				   'sound' => 'la-marseillaise.caf'],
    // Additional data
    'data' => ['king' => 'Louis XVI',
    		   'location' => 'La Bastille']
]);

```

### Change notification priority

[](#change-notification-priority)

The default notification **priority** is set to *high* (to always be sent). You can put it to *normal* if you want (then the receiving client system will choose when to display it).

```
$client->send([
    'registration_ids' => ['token1', 'token2', ...],
    'notification' => ['body_loc_key' => 'This is a revolution',
    				   'badge' => 1789
    				   'sound' => 'la-marseillaise.caf'],
    // Additional data
    'data' => ['king' => 'Louis XVI',
    		   'location' => 'La Bastille'],
    'priority' => 'normal'
]);

```

And that's it!

APNS Batch import
-----------------

[](#apns-batch-import)

If you are migrating from another service ([Parse](http://www.parse.com) for example) and you already have APNS tokens on your database, you can [batch import them to Firebase](https://developers.google.com/instance-id/reference/server#create_registration_tokens_for_apns_tokens).

To do so, just call the batchImport method with the following parameters:

- **application**: Bundle id of the application
- **sandbox**: Boolean to indicate sandbox environment (TRUE) or production (FALSE) - default to true
- **apns\_tokens**: The array of APNs tokens for the app instances you want to add or remove. *Maximum 100 tokens per request.*

Example:

```
$client->batchImport([
	'application' => "com.french.revolution",
	'apns_tokens' => ["Robespierre's token", "Danton's token", "Louis XVI's token", ...],
	'sandbox' => false,
]);

```

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1087284?v=4)[Talal MAZROUI](/maintainers/TalalM)[@TalalM](https://github.com/TalalM)

### Embed Badge

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

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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