2017 © Pedro Peláez
 

library fcm-simple

Simple PHP library for Firebase Cloud Messaging

image

coder966/fcm-simple

Simple PHP library for Firebase Cloud Messaging

  • Saturday, May 19, 2018
  • by coder966
  • Repository
  • 4 Watchers
  • 8 Stars
  • 107 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 4 Open issues
  • 11 Versions
  • 10 % Grown

The README.md

FCMSimple

Latest Stable Version License, (*1)

A PHP library to send messages to devices registered through Firebase Cloud Messaging (FCM)., (*2)

Features: - Lightweight & simple - Zero dependencies - Implemented using cURL - Support sending to topics and tokens - Support various message options like CollapseKey, Priority, TimeToLive and more - Provides you with the tokens you should update/remove from your database, (*3)

Usage

For further details, see the Wiki, (*4)

Installation

You need PHP >= 5.4, (*5)

$ composer require coder966/fcm-simple

PHP Server

require 'vendor/autoload.php';

use FCMSimple\Client;
use FCMSimple\Message;

// create the client
$client = new Client("YOUR_SERVER_KEY");

// create the message
$msg = new Message();
$msg->put("key1", "value1");
$msg->put("key2", "value2");

// send the message to a specific topic
$client->sendToTopic($msg, "my_topic");

// or you can send to specific devices using their registration tokens
// so first prepare your array of tokens, typically retrieve from DB
$tokens = [
    "token_1",
    "token_2",
    "token_3"
];
// and send
$client->sendToTokens($msg, $tokens);

Android Client

In the service that extends FirebaseMessagingService, in method onMessageReceived, use:, (*6)

Map<String, String> msg = remoteMessage.getData();
String value1 = msg.get("key1");
String value2 = msg.get("key2");

License

Copyright 2016 Khalid H. Alharisi

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

The Versions

19/05 2018

dev-master

9999999-dev https://github.com/coder966/FCMSimple

Simple PHP library for Firebase Cloud Messaging

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

php cloud messaging ios android firebase fcm

19/05 2018

dev-dev

dev-dev https://github.com/coder966/FCMSimple

Simple PHP library for Firebase Cloud Messaging

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

php cloud messaging ios android firebase fcm

19/05 2018

v3.2.1

3.2.1.0 https://github.com/coder966/FCMSimple

Simple PHP library for Firebase Cloud Messaging

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

php cloud messaging ios android firebase fcm

17/05 2018

v3.2.0

3.2.0.0 https://github.com/coder966/FCMSimple

Simple PHP library for Firebase Cloud Messaging

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

php cloud messaging ios android firebase fcm

31/03 2018

v1.0

1.0.0.0

  Sources   Download

31/03 2018

v1.1

1.1.0.0

  Sources   Download

07/08 2017

v3.1.0

3.1.0.0 https://github.com/coder966/FCMSimple

PHP simple application server implementation for Firebase Cloud Messaging

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

php cloud messaging ios android firebase fcm

12/06 2017

v3.0.0

3.0.0.0 https://github.com/coder966/FCMSimple

PHP simple application server implementation for Firebase Cloud Messaging

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

php cloud messaging ios android firebase fcm

12/11 2016

v2.0.0

2.0.0.0 https://github.com/coder966/FCMSimple

PHP simple application server implementation for Firebase Cloud Messaging

  Sources   Download

Apache-2.0

The Requires

  • php >=5.3.0

 

cloud messaging ios android firebase fcm

20/07 2016

v1.2.1

1.2.1.0 https://github.com/coder966/FCMSimple

PHP simple application server implementation for Firebase Cloud Messaging

  Sources   Download

GPL-3.0

The Requires

  • php >=5.3.0

 

cloud messaging ios android firebase fcm

20/07 2016

v1.2

1.2.0.0 https://github.com/coder966/FCMSimple

PHP simple application server implementation for Firebase Cloud Messaging

  Sources   Download

GPL-3.0

The Requires

  • php >=5.3.0

 

cloud messaging ios android firebase fcm