firebase-php

A simple php snippet for push message to firebase

usage

open firebase_lib.php file and change the api key to your own

Then you can include the libary and create an object of Firebase class

require 'firebase_lib.php';
// create new object for Firebase class 
$ob = new Firebase();

// configurate the device by invoking setDevice method with token as argument 
$ob->setDevice("-- device token --");

// build the message array 
$msg = array
(
    'body'   => 'Message body',
    'title'     => 'Message title',
    'custome_key'  => 'custom_value'
);

// call the push method to send notification 
$res = $ob->push($msg);
var_dump($res);