2017 © Pedro Peláez
 

symfony-bundle firebase-notification-bundle

A Bundle for Symfony2 projects to send notifications for mobile devices through Firebase Cloud Messaging API

image

jp/firebase-notification-bundle

A Bundle for Symfony2 projects to send notifications for mobile devices through Firebase Cloud Messaging API

  • Monday, September 18, 2017
  • by jplarar
  • Repository
  • 1 Watchers
  • 3 Stars
  • 115 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 39 % Grown

The README.md

FirebaseNotificationBundle

A Bundle for Symfony4 projects to send notifications for mobile devices through Firebase Cloud Messaging API, (*1)

Setup

Step 1: Download FirebaseNotificationBundle using composer

Add Firebase Notification in your composer.json:, (*2)

{
    "require": {
        "jp/firebase-notification-Bundle": "^2.0.0"
    }
}

Now tell composer to download the bundle by running the command:, (*3)

``` bash $ php composer.phar update "jp/firebase-notification-Bundle", (*4)



### Step 2: Enable the bundle Enable the bundle in the kernel: ``` php get('firebase_fcm_client'); ?>

Example

Create message and send message

``` php get('firebase_fcm_client'); $fcm->createMessage(array( 'to' => 'XXXXXXXX', 'title' => 'New message', 'body' => 'Hello World!', 'badge' => 1, 'data' => array( 'action' => "new_message" ) )); $data = $fcm->sendMessage(); ?>, (*5)


###Create topic message and send message ``` php <?php $fcm = $this->get('firebase_fcm_client'); $fcm->createMessage(array( 'topic' => '/topics/TOPIC_NAME', 'title' => 'New message', 'body' => 'Hello World!', 'badge' => 1, 'data' => array( 'action' => "new_message" ) )); $data = $fcm->sendMessage(); ?>

The Versions