2017 © Pedro Peláez
 

library php-fcm

PHP application server for google firebase cloud messaging (FCM)

image

paragraph1/php-fcm

PHP application server for google firebase cloud messaging (FCM)

  • Monday, July 2, 2018
  • by palbertini
  • Repository
  • 15 Watchers
  • 145 Stars
  • 128,579 Installations
  • PHP
  • 9 Dependents
  • 0 Suggesters
  • 43 Forks
  • 18 Open issues
  • 8 Versions
  • 13 % Grown

The README.md

phpFCM

Build Status Coverage Status Latest Stable Version Total Downloads License, (*1)

PHP application server implementation for Firebase Cloud Messaging. - supports device and topic messages - currently this app server library only supports sending Messages/Notifications via HTTP. - thanks to guzzle our library answers in PSR7 compatible response objects - see the full docs on firebase cloud messaging here : https://firebase.google.com/docs/cloud-messaging/ - Firebase Cloud Messaging HTTP Protocol: https://firebase.google.com/docs/cloud-messaging/http-server-ref#send-downstream for in-depth description, (*2)

Setup

The recommended way of installing is using Composer., (*3)

command line, (*4)

composer require paragraph1/php-fcm

composer.json, (*5)

"require": {
    "paragraph1/php-fcm": "*"
}

Send to Device

also see https://firebase.google.com/docs/cloud-messaging/downstream, (*6)

use paragraph1\phpFCM\Client;
use paragraph1\phpFCM\Message;
use paragraph1\phpFCM\Recipient\Device;
use paragraph1\phpFCM\Notification;

require_once 'vendor/autoload.php';

$apiKey = 'YOUR SERVER KEY';
$client = new Client();
$client->setApiKey($apiKey);
$client->injectHttpClient(new \GuzzleHttp\Client());

$note = new Notification('test title', 'testing body');
$note->setIcon('notification_icon_resource_name')
    ->setColor('#ffffff')
    ->setBadge(1);

$message = new Message();
$message->addRecipient(new Device('your-device-token'));
$message->setNotification($note)
    ->setData(array('someId' => 111));

$response = $client->send($message);
var_dump($response->getStatusCode());

Send to topic

also see https://firebase.google.com/docs/cloud-messaging/topic-messaging, (*7)

use paragraph1\phpFCM\Client;
use paragraph1\phpFCM\Message;
use paragraph1\phpFCM\Recipient\Topic;
use paragraph1\phpFCM\Notification;

require_once 'vendor/autoload.php';


$apiKey = 'YOUR SERVER KEY';
$client = new Client();
$client->setApiKey($apiKey);
$client->injectHttpClient(new \GuzzleHttp\Client());

$message = new Message();
$message->addRecipient(new Topic('your-topic'));
//select devices where has 'your-topic1' && 'your-topic2' topics
$message->addRecipient(new Topic(['your-topic1', 'your-topic2']));
$message->setNotification(new Notification('test title', 'testing body'))
    ->setData(array('someId' => 111));

$response = $client->send($message);
var_dump($response->getStatusCode());

The Versions

02/07 2018

dev-master

9999999-dev https://github.com/Paragraph1/phpFCM

PHP application server for google firebase cloud messaging (FCM)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Patrick Albertini
by Kai Bielenberg

php google ios gcm android firebase notifications fcm firebase cloud messaging

18/08 2016

0.7

0.7.0.0 https://github.com/Paragraph1/phpFCM

PHP application server for google firebase cloud messaging (FCM)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Patrick Albertini
by Kai Bielenberg

php google ios gcm android firebase notifications fcm firebase cloud messaging

08/08 2016

0.6

0.6.0.0 https://github.com/Paragraph1/phpFCM

PHP application server for google firebase cloud messaging (FCM)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Patrick Albertini
by Kai Bielenberg

php google ios gcm android firebase notifications fcm firebase cloud messaging

15/06 2016

0.5

0.5.0.0 https://github.com/Paragraph1/phpFCM

PHP application server for google firebase cloud messaging (FCM)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Patrick Albertini
by Kai Bielenberg

php google ios gcm android firebase notifications fcm firebase cloud messaging

02/06 2016

0.4

0.4.0.0 https://github.com/Paragraph1/phpFCM

PHP application server for google firebase cloud messaging (FCM)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Patrick Albertini
by Kai Bielenberg

php google ios android firebase notifications fcm

02/06 2016

0.3

0.3.0.0 https://github.com/Paragraph1/phpFCM

PHP application server for google firebase cloud messaging (FCM)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Patrick Albertini
by Kai Bielenberg

php google ios android firebase notifications fcm

02/06 2016

0.2

0.2.0.0 https://github.com/Paragraph1/phpFCM

PHP application server for google firebase cloud messaging (FCM)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Patrick Albertini
by Kai Bielenberg

php google ios android firebase notifications fcm

02/06 2016

0.1

0.1.0.0 https://github.com/Paragraph1/phpFCM

PHP application server for google firebase cloud messaging (FCM)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Patrick Albertini
by Kai Bielenberg

php google ios android firebase notifications fcm