Skip to content

Commit 4203d31

Browse files
committed
minor #20076 [Notifier] Create DesktopChannel and JoliNotif bridge (ahmedghanem00)
This PR was squashed before being merged into the 7.2 branch. Discussion ---------- [Notifier] Create `DesktopChannel` and `JoliNotif` bridge Updating docs according to symfony/symfony#57683 Fixes #20168 Commits ------- 45ba59f [Notifier] Create `DesktopChannel` and `JoliNotif` bridge
2 parents 04b708b + 45ba59f commit 4203d31

File tree

1 file changed

+80
-4
lines changed

1 file changed

+80
-4
lines changed

notifier.rst

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Get the Notifier installed using:
1616
1717
.. _channels-chatters-texters-email-and-browser:
1818

19-
Channels: Chatters, Texters, Email, Browser and Push
20-
----------------------------------------------------
19+
Channels: Chatters, Texters, Email, Browser, Push and Desktop
20+
-------------------------------------------------------------
2121

2222
The notifier component can send notifications to different channels. Each
2323
channel can integrate with different providers (e.g. Slack or Twilio SMS)
@@ -32,6 +32,7 @@ The notifier component supports the following channels:
3232
* :ref:`Email channel <notifier-email-channel>` integrates the :doc:`Symfony Mailer </mailer>`;
3333
* Browser channel uses :ref:`flash messages <flash-messages>`.
3434
* :ref:`Push channel <notifier-push-channel>` sends notifications to phones and browsers via push notifications.
35+
* :ref:`Desktop channel <notifier-desktop-channel>` displays desktop notifications on the same host machine.
3536

3637
.. tip::
3738

@@ -623,6 +624,79 @@ configure the ``texter_transports``:
623624
;
624625
};
625626
627+
.. _notifier-desktop-channel:
628+
629+
Desktop Channel
630+
~~~~~~~~~~~~~~~
631+
632+
The desktop channel is used to display desktop notifications on the same host machine using
633+
:class:`Symfony\\Component\\Notifier\\Texter` classes. Currently, Symfony
634+
is integrated with the following providers:
635+
636+
=============== ==================================== ==============================================================================
637+
Provider Package DSN
638+
=============== ==================================== ==============================================================================
639+
`JoliNotif`_ ``symfony/joli-notif-notifier`` ``jolinotif://default``
640+
=============== ==================================== ==============================================================================
641+
642+
.. versionadded: 7.2
643+
644+
The JoliNotif bridge was introduced in Symfony 7.2.
645+
646+
To enable a texter, add the correct DSN in your ``.env`` file and
647+
configure the ``texter_transports``:
648+
649+
.. code-block:: bash
650+
651+
# .env
652+
JOLINOTIF=jolinotif://default
653+
654+
.. configuration-block::
655+
656+
.. code-block:: yaml
657+
658+
# config/packages/notifier.yaml
659+
framework:
660+
notifier:
661+
texter_transports:
662+
jolinotif: '%env(JOLINOTIF)%'
663+
664+
.. code-block:: xml
665+
666+
<!-- config/packages/notifier.xml -->
667+
<?xml version="1.0" encoding="UTF-8" ?>
668+
<container xmlns="http://symfony.com/schema/dic/services"
669+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
670+
xmlns:framework="http://symfony.com/schema/dic/symfony"
671+
xsi:schemaLocation="http://symfony.com/schema/dic/services
672+
https://symfony.com/schema/dic/services/services-1.0.xsd
673+
http://symfony.com/schema/dic/symfony
674+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
675+
676+
<framework:config>
677+
<framework:notifier>
678+
<framework:texter-transport name="jolinotif">
679+
%env(JOLINOTIF)%
680+
</framework:texter-transport>
681+
</framework:notifier>
682+
</framework:config>
683+
</container>
684+
685+
.. code-block:: php
686+
687+
// config/packages/notifier.php
688+
use Symfony\Config\FrameworkConfig;
689+
690+
return static function (FrameworkConfig $framework): void {
691+
$framework->notifier()
692+
->texterTransport('jolinotif', env('JOLINOTIF'))
693+
;
694+
};
695+
696+
.. versionadded:: 7.2
697+
698+
The ``Desktop`` channel was introduced in Symfony 7.2.
699+
626700
Configure to use Failover or Round-Robin Transports
627701
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
628702

@@ -926,9 +1000,10 @@ and its ``asChatMessage()`` method::
9261000

9271001
The
9281002
:class:`Symfony\\Component\\Notifier\\Notification\\SmsNotificationInterface`,
929-
:class:`Symfony\\Component\\Notifier\\Notification\\EmailNotificationInterface`
930-
and
1003+
:class:`Symfony\\Component\\Notifier\\Notification\\EmailNotificationInterface`,
9311004
:class:`Symfony\\Component\\Notifier\\Notification\\PushNotificationInterface`
1005+
and
1006+
:class:`Symfony\\Component\\Notifier\\Notification\\DesktopNotificationInterface`
9321007
also exists to modify messages sent to those channels.
9331008

9341009
Customize Browser Notifications (Flash Messages)
@@ -1114,6 +1189,7 @@ is dispatched. Listeners receive a
11141189
.. _`Infobip`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Infobip/README.md
11151190
.. _`Iqsms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Iqsms/README.md
11161191
.. _`iSendPro`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/Isendpro/README.md
1192+
.. _`JoliNotif`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/JoliNotif/README.md
11171193
.. _`KazInfoTeh`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/KazInfoTeh/README.md
11181194
.. _`LINE Notify`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/LineNotify/README.md
11191195
.. _`LightSms`: https://github.com/symfony/symfony/blob/{version}/src/Symfony/Component/Notifier/Bridge/LightSms/README.md

0 commit comments

Comments
 (0)