Download the PHP package mehdibo/php-fcm without Composer
On this page you can find all versions of the php package mehdibo/php-fcm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mehdibo/php-fcm
More information about mehdibo/php-fcm
Files in mehdibo/php-fcm
Package php-fcm
Short Description A PHP library to send Push notifications using FCM (Firebase Cloud Messaging)
License MIT
Homepage https://github.com/mehdibo/php-fcm
Informations about the package php-fcm
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
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
- 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
After 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
Add the library to your project using
That's it you can start using it like this:
Using it with symfony
To use this library with Symfony, I recommend the following approach:
Add the library to your project using
If you are using Symfony flex you will be prompted to execute a recipe. Choose No
Add the following vars to your .env
file:
Add services to your services.yaml
file:
Getting device info
Fetching the device info uses the Legacy API, that uses a Server Key
Get the server key by:
- 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 Cloud Messaging tab
- You will find the Server Key there