Skip to content

baron-suslin/firebase-notifier

 
 

Repository files navigation

Firebase Notifier

Provides Firebase integration for Symfony Notifier.

JWT DSN Example (HTTP v1)

FIREBASE_DSN=firebase://<CLIENT_EMAIL>?project_id=<PROJECT_ID>&private_key_id=<PRIVATE_KEY_ID>&private_key=<PRIVATE_KEY>
FIREBASE_DSN=firebase://[email protected]?project_id=<PROJECT_ID>&private_key_id=<PRIVATE_KEY_ID>&private_key=<PRIVATE_KEY>

Since "private_key" is long, you must write it in a single line with "\n". Example:

-----BEGIN RSA PRIVATE KEY-----\n.....\n....\n-----END RSA PRIVATE KEY-----

Required Options:

  • client_email
  • project_id
  • private_key_id
  • private_key

Adding Interactions to a Message

With a Firebase message, you can use the AndroidNotification, IOSNotification or WebNotification classes to add message options.

use Symfony\Component\Notifier\Message\ChatMessage;
use Symfony\Component\Notifier\Bridge\Firebase\Notification\AndroidNotification;

$chatMessage = new ChatMessage('');

// Create AndroidNotification options
$androidOptions = (new AndroidNotification('/topics/news', [], [], true))
    ->icon('myicon')
    ->sound('default')
    ->tag('myNotificationId')
    ->color('#cccccc')
    ->clickAction('OPEN_ACTIVITY_1')
    // ...
    ;

// Add the custom options to the chat message and send the message
$chatMessage->options($androidOptions);

$chatter->send($chatMessage);

Resources

About

Symfony Firebase Notifier Bridge

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%