Provides new Firebase HTTP v1 API integration for Symfony Notifier.
GOOGLE_API_KEY=YOUR_API_KEY
GOOGLE_CLIENT_ID=YOUR_CLIENT_KEY
GOOGLE_CLIENT_SECRET=YOUR_CLIENT_SECRET
FIREBASE_DSN=firebase://PROJECT_ID@default
FIREBASE_JSON='{
"key": "value",
...
}'
where:
YOUR_API_KEYis your Google API keyYOUR_CLIENT_KEYis your Google client IDYOUR_CLIENT_SECRETis your Google client secretPROJECT_IDis your Firebase project ID
For FIREBASE_JSON you have to download JSON file containing Firebase credentials.
In Firebase console navigate to "Project settings" -> "Service accounts".
Click "Generate new private key", download the JSON file and paste its contents.
Google credentials can be obtained in Google console.
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', []))
->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);