@@ -85,22 +85,22 @@ The following example shows how you can deliver notifications about Commerce-rel
8585
86861 . Install the Slack Notifier package:
8787
88- ``` bash
89- composer require symfony/slack-notifier
90- ```
88+ ``` bash
89+ composer require symfony/slack-notifier
90+ ```
9191
92922. In a .env file, [set the DSN to target a Slack channel or a Slack user](https://github.com/symfony/slack-notifier? tab=readme-ov-file#dsn-example):
9393
94- ``` dotenv
95- SLACK_DSN=slack://xoxb-token@default?channel=ibexa-notifications
96- ```
94+ ` ` ` dotenv
95+ SLACK_DSN=slack://xoxb-token@default? channel=ibexa-notifications
96+ ` ` `
9797
98983. Subscribe to notification types related to Commerce, such as order, payment, and shipment status changes.
99- For example, define the following configuration in a new ` config/packages/notifications.yaml ` file:
99+ For example, define the following configuration in a new ` config/packages/notifications.yaml` file:
100100
101- ``` yaml hl_lines="12-20"
102- [[= include_code('code_samples/api/notifications/config/packages/notifications.yaml', 1, 20) =]]
103- ```
101+ ` ` ` yaml hl_lines=" 12-20"
102+ [[= include_code(' code_samples/api/notifications/config/packages/notifications.yaml' , 1, 20, indent_level=1 ) = ]]
103+ ` ` `
104104
105105# # Create notification class
106106
@@ -159,26 +159,26 @@ The following example is a command that sends a notification to users on several
159159This example could be a scheduled task or cron job that warns users about its result.
160160
1611611. First, create a `CommandExecuted` notification type.
162- It supports two channels (` ibexa ` , ` email ` ), but could be extended to support more.
163- As constructor arguments, an instance takes the command itself, the exit code of the run, and any caught exceptions.
162+ It supports two channels (`ibexa`, `email`), but could be extended to support more.
163+ As constructor arguments, an instance takes the command itself, the exit code of the run, and any caught exceptions.
164164
165- ``` php
166- [[= include_code('code_samples/api/notifications/src/Notifications/CommandExecuted.php') =]]
167- ```
165+ ``` php
166+ [[= include_code(' code_samples/api/notifications/src/Notifications/CommandExecuted.php' , indent_level=1 ) =]]
167+ ```
168168
1691692. Assign channels subscribed to this notification in `config/packages/notifications.yaml`:
170170
171- ``` yaml hl_lines="17-20"
172- [[= include_code('code_samples/api/notifications/config/packages/notifications.yaml', 5, 24) =]]
173- ```
171+ ``` yaml hl_lines="17-20"
172+ [[= include_code(' code_samples/api/notifications/config/packages/notifications.yaml' , 5, 24, indent_level=1 ) =]]
173+ ```
174174
1751753. Create a command sending a `CommandExecuted` notification at the end of execution:
176- It randomly succeeds or fails to demonstrate how notifications can communicate different execution results.
177- It could be declared as a service to set the list of recipients' logins (` $recipientLogins ` ) from a configuration file.
176+ It randomly succeeds or fails to demonstrate how notifications can communicate different execution results.
177+ It could be declared as a service to set the list of recipients' logins (` $recipientLogins ` ) from a configuration file.
178178
179- ``` php
180- [[= include_code('code_samples/api/notifications/src/Command/NotificationSenderCommand.php') =]]
181- ```
179+ ` ` ` php
180+ [[= include_code(' code_samples/api/notifications/src/Command/NotificationSenderCommand.php' , indent_level=1 ) = ]]
181+ ` ` `
182182
183183When you execute this command, it fails randomly and notifies the Administrator user about the result.
184184
0 commit comments