Skip to content

Commit 22a8d45

Browse files
committed
minor #21816 [FrameworkBundle] Add Notifier configuration reference (lacatoire)
This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [FrameworkBundle] Add Notifier configuration reference Summary Add missing Notifier configuration to the Framework Configuration Reference Document chatter_transports, texter_transports, channel_policy, admin_recipients and message_bus options Include YAML and PHP configuration examples Fixes #21787 Commits ------- 5cffe82 [FrameworkBundle] Add Notifier configuration reference
2 parents 981e076 + 5cffe82 commit 22a8d45

File tree

1 file changed

+168
-0
lines changed

1 file changed

+168
-0
lines changed

reference/configuration/framework.rst

Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3715,6 +3715,174 @@ Whether to enable or not Messenger.
37153715
For more details, see the :doc:`Messenger component </messenger>`
37163716
documentation.
37173717

3718+
notifier
3719+
~~~~~~~~
3720+
3721+
chatter_transports
3722+
..................
3723+
3724+
**type**: ``array`` **default**: ``[]``
3725+
3726+
Configures the chatter transports used for chat notifications (e.g. Slack, Telegram).
3727+
The transport name is the key and the DSN is the value:
3728+
3729+
.. configuration-block::
3730+
3731+
.. code-block:: yaml
3732+
3733+
# config/packages/notifier.yaml
3734+
framework:
3735+
notifier:
3736+
chatter_transports:
3737+
slack: '%env(SLACK_DSN)%'
3738+
telegram: '%env(TELEGRAM_DSN)%'
3739+
3740+
.. code-block:: php
3741+
3742+
// config/packages/notifier.php
3743+
use Symfony\Config\FrameworkConfig;
3744+
3745+
return static function (FrameworkConfig $framework): void {
3746+
$framework->notifier()
3747+
->chatterTransport('slack', '%env(SLACK_DSN)%')
3748+
->chatterTransport('telegram', '%env(TELEGRAM_DSN)%')
3749+
;
3750+
};
3751+
3752+
texter_transports
3753+
.................
3754+
3755+
**type**: ``array`` **default**: ``[]``
3756+
3757+
Configures the texter transports used for SMS notifications (e.g. Twilio, Vonage).
3758+
The transport name is the key and the DSN is the value:
3759+
3760+
.. configuration-block::
3761+
3762+
.. code-block:: yaml
3763+
3764+
# config/packages/notifier.yaml
3765+
framework:
3766+
notifier:
3767+
texter_transports:
3768+
twilio: '%env(TWILIO_DSN)%'
3769+
3770+
.. code-block:: php
3771+
3772+
// config/packages/notifier.php
3773+
use Symfony\Config\FrameworkConfig;
3774+
3775+
return static function (FrameworkConfig $framework): void {
3776+
$framework->notifier()
3777+
->texterTransport('twilio', '%env(TWILIO_DSN)%')
3778+
;
3779+
};
3780+
3781+
channel_policy
3782+
..............
3783+
3784+
**type**: ``array`` **default**: ``[]``
3785+
3786+
Defines which channels are used for each notification importance level.
3787+
The key is the importance level (``urgent``, ``high``, ``medium``, ``low``)
3788+
and the value is an array of channel names:
3789+
3790+
.. configuration-block::
3791+
3792+
.. code-block:: yaml
3793+
3794+
# config/packages/notifier.yaml
3795+
framework:
3796+
notifier:
3797+
channel_policy:
3798+
urgent: ['sms', 'chat/slack', 'email']
3799+
high: ['chat/slack']
3800+
medium: ['browser']
3801+
low: ['browser']
3802+
3803+
.. code-block:: php
3804+
3805+
// config/packages/notifier.php
3806+
use Symfony\Config\FrameworkConfig;
3807+
3808+
return static function (FrameworkConfig $framework): void {
3809+
$framework->notifier()
3810+
->channelPolicy('urgent', ['sms', 'chat/slack', 'email'])
3811+
->channelPolicy('high', ['chat/slack'])
3812+
->channelPolicy('medium', ['browser'])
3813+
->channelPolicy('low', ['browser'])
3814+
;
3815+
};
3816+
3817+
admin_recipients
3818+
................
3819+
3820+
**type**: ``array`` **default**: ``[]``
3821+
3822+
Configures the recipients of notifications sent to administrators. Each recipient
3823+
can have an ``email`` and/or a ``phone`` number:
3824+
3825+
.. configuration-block::
3826+
3827+
.. code-block:: yaml
3828+
3829+
# config/packages/notifier.yaml
3830+
framework:
3831+
notifier:
3832+
admin_recipients:
3833+
- { email: 'admin@example.com' }
3834+
- { email: 'lead@example.com', phone: '+1555123456' }
3835+
3836+
.. code-block:: php
3837+
3838+
// config/packages/notifier.php
3839+
use Symfony\Config\FrameworkConfig;
3840+
3841+
return static function (FrameworkConfig $framework): void {
3842+
$framework->notifier()
3843+
->adminRecipient()
3844+
->email('admin@example.com')
3845+
;
3846+
$framework->notifier()
3847+
->adminRecipient()
3848+
->email('lead@example.com')
3849+
->phone('+1555123456')
3850+
;
3851+
};
3852+
3853+
message_bus
3854+
...........
3855+
3856+
**type**: ``string`` | ``false`` **default**: ``null`` or default bus if Messenger component is installed
3857+
3858+
Defines which message bus is used to dispatch notification messages. Set to
3859+
``false`` to call the notifier transport directly instead of dispatching
3860+
through the bus:
3861+
3862+
.. configuration-block::
3863+
3864+
.. code-block:: yaml
3865+
3866+
# config/packages/notifier.yaml
3867+
framework:
3868+
notifier:
3869+
message_bus: false
3870+
3871+
.. code-block:: php
3872+
3873+
// config/packages/notifier.php
3874+
use Symfony\Config\FrameworkConfig;
3875+
3876+
return static function (FrameworkConfig $framework): void {
3877+
$framework->notifier()
3878+
->messageBus(false)
3879+
;
3880+
};
3881+
3882+
.. seealso::
3883+
3884+
For more details, see the :doc:`Notifier component </notifier>` documentation.
3885+
37183886
web_link
37193887
~~~~~~~~
37203888

0 commit comments

Comments
 (0)