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

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

mehdibo/php-fcm
===============

A PHP library to send Push notifications using FCM (Firebase Cloud Messaging)

0.1.1(6y ago)152MITPHPPHP ^7.4

Since May 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/mehdibo/php-fcm)[ Packagist](https://packagist.org/packages/mehdibo/php-fcm)[ Docs](https://github.com/mehdibo/php-fcm)[ RSS](/packages/mehdibo-php-fcm/feed)WikiDiscussions develop Synced 6d ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

php-fcm [![PHP Tests](https://github.com/mehdibo/php-fcm/workflows/PHP%20Tests/badge.svg?branch=develop)](https://github.com/mehdibo/php-fcm/workflows/PHP%20Tests/badge.svg?branch=develop) [![Latest Stable Version](https://camo.githubusercontent.com/09e3a4d0a70337fed13392ec12638b7532074f84ee59f654e0e91f3b9cecd6b9/68747470733a2f2f706f7365722e707567782e6f72672f6d65686469626f2f7068702d66636d2f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/mehdibo/php-fcm) [![Total Downloads](https://camo.githubusercontent.com/1379b9bb8384851292eef5022994031164d0ce9466c0d6e88116b1aecdd90bb1/68747470733a2f2f706f7365722e707567782e6f72672f6d65686469626f2f7068702d66636d2f646f776e6c6f6164733f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/mehdibo/php-fcm) [![GitHub license](https://camo.githubusercontent.com/430e50188de7b78a99859d652b99aacdde18ae806ecf26f5072ff1ef42112e76/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d65686469626f2f7068702d66636d3f7374796c653d666c61742d737175617265)](https://github.com/mehdibo/php-fcm/blob/develop/LICENSE) [![GitHub issues](https://camo.githubusercontent.com/78089024052c263a05a3d774b0f17d4c20d907c7e6fa8f501fea2abbe35a598c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6d65686469626f2f7068702d66636d3f7374796c653d666c61742d737175617265)](https://github.com/mehdibo/php-fcm/issues) [![GitHub forks](https://camo.githubusercontent.com/fc1225efaec205454b2c0b0067995a1b8150bc66b61342c08d1442a2f9cdca5d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6d65686469626f2f7068702d66636d3f7374796c653d666c61742d737175617265)](https://github.com/mehdibo/php-fcm/network) [![GitHub stars](https://camo.githubusercontent.com/128d27d520d08784d9d4d31be1b1207738f56d1fb7212a73351d5e8efc3962af/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d65686469626f2f7068702d66636d)](https://github.com/mehdibo/php-fcm/stargazers)
==============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#php-fcm-------)

A PHP library to send Push notifications using FCM (Firebase Cloud Messaging)

Do not use the `Android\*` notifications feature as it is still experimental and may change anytime.

Setup
-----

[](#setup)

### Getting the service account key

[](#getting-the-service-account-key)

Before using the library, you need to get a JSON file containing the neccessary credentials.

- Go to the [Firebase console](https://console.firebase.google.com/u/0/)
- Add a project if you don't have one
- Go to your project dashboard
- On the top left, under the Firebase logo, Click on the cog icon and select *Project settings*
- Go to the *Service accounts* tab. Click on *Create service account* if you don't already have one.
- Click on *Generate new private key*, a prompt will appear, click on *Generate key*.
- A JSON file will start downloading

### Getting the Project ID

[](#getting-the-project-id)

After [Getting the service account key](#getting-the-service-account-key), getting the Project ID is farily easy

- Go to your project dashboard
- On the top left, under the Firebase logo, Click on the cog icon and select *Project settings*
- You are in the *General tab*
- The *Project ID* is right under the *Project name*

Usage
-----

[](#usage)

Add the library to your project using

```
composer require mehdibo/php-fcm
```

That's it you can start using it like this:

```
