Skip to content

Commit a504ba4

Browse files
committed
minor symfony#49980 [Notifier] Document Firebase options object in readme (alamirault)
This PR was merged into the 5.4 branch. Discussion ---------- [Notifier] Document Firebase options object in readme | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> Notifier bridges documentation is now in readme. This PR add missing documentation for Firebase Options. (Initially working on symfony/symfony-docs#14950) Commits ------- a116859 [Notifier] Document Firebase options object in readme
2 parents 46b6994 + a116859 commit a504ba4

File tree

1 file changed

+28
-0
lines changed
  • src/Symfony/Component/Notifier/Bridge/Firebase

1 file changed

+28
-0
lines changed

src/Symfony/Component/Notifier/Bridge/Firebase/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,34 @@ where:
1414
- `USERNAME` is your Firebase username
1515
- `PASSWORD` is your Firebase password
1616

17+
Adding Interactions to a Message
18+
--------------------------------
19+
20+
With a Firebase message, you can use the `AndroidNotification`, `IOSNotification` or `WebNotification` classes to add
21+
[message options](https://firebase.google.com/docs/cloud-messaging/xmpp-server-ref.html).
22+
23+
```php
24+
use Symfony\Component\Notifier\Message\ChatMessage;
25+
use Symfony\Component\Notifier\Bridge\Firebase\Notification\AndroidNotification;
26+
27+
$chatMessage = new ChatMessage('');
28+
29+
// Create AndroidNotification options
30+
$androidOptions = (new AndroidNotification('/topics/news', []))
31+
->icon('myicon')
32+
->sound('default')
33+
->tag('myNotificationId')
34+
->color('#cccccc')
35+
->clickAction('OPEN_ACTIVITY_1')
36+
// ...
37+
;
38+
39+
// Add the custom options to the chat message and send the message
40+
$chatMessage->options($androidOptions);
41+
42+
$chatter->send($chatMessage);
43+
```
44+
1745
Resources
1846
---------
1947

0 commit comments

Comments
 (0)