Skip to content

Commit faa17e1

Browse files
committed
minor #16077 Add Push Channel with Integration Expo & OneSignal (zairigimad)
This PR was merged into the 5.4 branch. Discussion ---------- Add Push Channel with Integration Expo & OneSignal Adding documentation for - #15946 - #16027 Commits ------- 3fc3c5f Add Push Channel with Integration Expo & OneSignal
2 parents b7f9b71 + 3fc3c5f commit faa17e1

File tree

1 file changed

+72
-2
lines changed

1 file changed

+72
-2
lines changed

notifier.rst

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Get the Notifier installed using:
2121
2222
$ composer require symfony/notifier
2323
24-
Channels: Chatters, Texters, Email and Browser
25-
----------------------------------------------
24+
Channels: Chatters, Texters, Email, Browser and Push
25+
----------------------------------------------------
2626

2727
The notifier component can send notifications to different channels. Each
2828
channel can integrate with different providers (e.g. Slack or Twilio SMS)
@@ -36,6 +36,7 @@ The notifier component supports the following channels:
3636
services like Slack and Telegram;
3737
* :ref:`Email channel <notifier-email-channel>` integrates the :doc:`Symfony Mailer </mailer>`;
3838
* Browser channel uses :ref:`flash messages <flash-messages>`.
39+
* Push Channel sends notifications to phones via push notifications.
3940

4041
.. tip::
4142

@@ -317,6 +318,75 @@ notification emails:
317318
;
318319
};
319320
321+
Push Channel
322+
~~~~~~~~~~~~
323+
324+
The push channel is used to send notifications to users by using
325+
:class:`Symfony\\Component\\Notifier\\Texter` classes. Symfony provides
326+
integration with these push services:
327+
328+
============== ==================================== =================================================================================
329+
Service Package DSN
330+
============== ==================================== =================================================================================
331+
Firebase ``symfony/firebase-notifier`` ``firebase://USERNAME:PASSWORD@default``
332+
Expo ``symfony/expo-notifier`` ``expo://Token@default``
333+
OneSignal ``symfony/one-signal-notifier`` ``onesignal://APP_ID:API_KEY@default?defaultRecipientId=DEFAULT_RECIPIENT_ID''``
334+
============== ==================================== =================================================================================
335+
336+
.. versionadded:: 5.4
337+
338+
The Expo and OneSignal integrations were introduced in Symfony 5.4.
339+
340+
To enable a texter, add the correct DSN in your ``.env`` file and
341+
configure the ``texter_transports``:
342+
343+
.. code-block:: bash
344+
345+
# .env
346+
EXPO_DSN=expo://TOKEN@default
347+
348+
.. configuration-block::
349+
350+
.. code-block:: yaml
351+
352+
# config/packages/notifier.yaml
353+
framework:
354+
notifier:
355+
texter_transports:
356+
expo: '%env(EXPO_DSN)%'
357+
358+
.. code-block:: xml
359+
360+
<!-- config/packages/notifier.xml -->
361+
<?xml version="1.0" encoding="UTF-8" ?>
362+
<container xmlns="http://symfony.com/schema/dic/services"
363+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
364+
xmlns:framework="http://symfony.com/schema/dic/symfony"
365+
xsi:schemaLocation="http://symfony.com/schema/dic/services
366+
https://symfony.com/schema/dic/services/services-1.0.xsd
367+
http://symfony.com/schema/dic/symfony
368+
https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
369+
370+
<framework:config>
371+
<framework:notifier>
372+
<framework:texter-transport name="expo">
373+
%env(EXPO_DSN)%
374+
</framework:texter-transport>
375+
</framework:notifier>
376+
</framework:config>
377+
</container>
378+
379+
.. code-block:: php
380+
381+
// config/packages/notifier.php
382+
use Symfony\Config\FrameworkConfig;
383+
384+
return static function (FrameworkConfig $framework) {
385+
$framework->notifier()
386+
->texterTransport('expo', '%env(EXPO_DSN)%')
387+
;
388+
};
389+
320390
Configure to use Failover or Round-Robin Transports
321391
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
322392

0 commit comments

Comments
 (0)