From 9c7036944cb1290db1edfc5f08593e52dfcac7ee Mon Sep 17 00:00:00 2001 From: Antoine Lamirault Date: Wed, 23 Apr 2025 23:13:23 +0200 Subject: [PATCH] [Notifier] Document Notifier Mercure options in README file --- .../Notifier/Bridge/Mercure/README.md | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/Symfony/Component/Notifier/Bridge/Mercure/README.md b/src/Symfony/Component/Notifier/Bridge/Mercure/README.md index 2d83e3d6d656d..3e9b1d6e2e69b 100644 --- a/src/Symfony/Component/Notifier/Bridge/Mercure/README.md +++ b/src/Symfony/Component/Notifier/Bridge/Mercure/README.md @@ -14,6 +14,34 @@ where: - `HUB_ID` is the Mercure hub id - `TOPIC` is the topic IRI (optional, default: `https://symfony.com/notifier`. Could be either a single topic: `topic=https://foo` or multiple topics: `topic[]=/foo/1&topic[]=https://bar`) + +Adding Options to a Chat Message +-------------------------------- + +With a Mercure Chat Message, you can use the `MercureOptions` class to add +message options. + +```php +use Symfony\Component\Notifier\Message\ChatMessage; +use Symfony\Component\Notifier\Bridge\Mercure\MercureOptions; + +$chatMessage = new ChatMessage('Contribute To Symfony'); + +$options = new MercureOptions( + ['/topic/1', '/topic/2'], + true, + 'id', + 'type', + 1, + ['tag' => '1234', 'body' => 'TEST'] +); + +// Add the custom options to the chat message and send the message +$chatMessage->options($options); + +$chatter->send($chatMessage); +``` + Resources ---------