@@ -21,8 +21,8 @@ Get the Notifier installed using:
21
21
22
22
$ composer require symfony/notifier
23
23
24
- Channels: Chatters, Texters, Email and Browser
25
- ----------------------------------------------
24
+ Channels: Chatters, Texters, Email, Browser and Push
25
+ ----------------------------------------------------
26
26
27
27
The notifier component can send notifications to different channels. Each
28
28
channel can integrate with different providers (e.g. Slack or Twilio SMS)
@@ -36,6 +36,7 @@ The notifier component supports the following channels:
36
36
services like Slack and Telegram;
37
37
* :ref: `Email channel <notifier-email-channel >` integrates the :doc: `Symfony Mailer </mailer >`;
38
38
* Browser channel uses :ref: `flash messages <flash-messages >`.
39
+ * Push Channel sends notifications to phones via push notifications.
39
40
40
41
.. tip ::
41
42
@@ -317,6 +318,75 @@ notification emails:
317
318
;
318
319
};
319
320
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
+
320
390
Configure to use Failover or Round-Robin Transports
321
391
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
322
392
0 commit comments