/php-fcm-client

Firebase Cloud Messaging (FCM) client for PHP

Primary LanguagePHPMIT LicenseMIT

PHP-FCM-Client

A Simple PHP Library for sending FCM (Firebase Cloud Messages)

Requirement

  • PHP >= 7.0
  • Composer as package manager

Installation

composer require nasrul21/php-fcm-client

Quickstart

<?php

// load composer
require 'vendor/autoload.php';

// set api key
$apiKey = "..." // your fcm api key

// initialize FCMClient with apiKey as params
$fcm = new FCMClient($apiKey);

$registration_ids = ["...", "..."];
$title = "Hello!";
$body = "This is the body";

// send fcm notifications
$fcm->send($registration_ids, $title, $body);

License

MIT