Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9e073fe

Browse files
committed
Fixed some more
1 parent c25e596 commit 9e073fe

File tree

3 files changed

+107
-105
lines changed

3 files changed

+107
-105
lines changed

mailer.rst

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -509,20 +509,20 @@ and headers.
509509
.. code-block:: php
510510
511511
// config/packages/mailer.php
512-
$container->loadFromExtension('framework', [
513-
// ...
514-
'mailer' => [
515-
'envelope' => [
516-
'sender' => '[email protected]',
517-
'recipients' => ['[email protected]', '[email protected]'],
518-
],
519-
'headers' => [
520-
'from' => 'Fabien <fabien@example.com>',
521-
'bcc' => '[email protected]',
522-
'X-Custom-Header' => 'foobar',
523-
],
524-
],
525-
]);
512+
use Symfony\Config\FrameworkConfig;
513+
514+
return static function (FrameworkConfig $framework) {
515+
$mailer = $framework->mailer();
516+
$mailer
517+
->envelope()
518+
->sender('[email protected]')
519+
520+
;
521+
522+
$mailer->header('from')->value('Fabien <fabien@example.com>');
523+
$mailer->header('bcc')->value('[email protected]');
524+
$mailer->header('X-Custom-Header')->value('foobar');
525+
};
526526
527527
.. versionadded:: 5.2
528528

@@ -1089,15 +1089,14 @@ This can be configured by replacing the ``dsn`` configuration entry with a
10891089
.. code-block:: php
10901090
10911091
// config/packages/mailer.php
1092-
$container->loadFromExtension('framework', [
1093-
// ...
1094-
'mailer' => [
1095-
'transports' => [
1096-
'main' => '%env(MAILER_DSN)%',
1097-
'alternative' => '%env(MAILER_DSN_IMPORTANT)%',
1098-
],
1099-
],
1100-
]);
1092+
use Symfony\Config\FrameworkConfig;
1093+
1094+
return static function (FrameworkConfig $framework) {
1095+
$framework->mailer()
1096+
->transport('main', '%env(MAILER_DSN)%')
1097+
->transport('alternative', '%env(MAILER_DSN_IMPORTANT)%')
1098+
;
1099+
};
11011100
11021101
By default the first transport is used. The other transports can be used by
11031102
adding a text header ``X-Transport`` to an email::
@@ -1160,16 +1159,17 @@ you have a transport called ``async``, you can route the message there:
11601159
.. code-block:: php
11611160
11621161
// config/packages/messenger.php
1163-
$container->loadFromExtension('framework', [
1164-
'messenger' => [
1165-
'transports' => [
1166-
'async' => '%env(MESSENGER_TRANSPORT_DSN)%',
1167-
],
1168-
'routing' => [
1169-
'Symfony\Component\Mailer\Messenger\SendEmailMessage' => 'async',
1170-
],
1171-
],
1172-
]);
1162+
use Symfony\Config\FrameworkConfig;
1163+
1164+
return static function (FrameworkConfig $framework) {
1165+
$framework->messenger()
1166+
->transport('async')->dsn('%env(MESSENGER_TRANSPORT_DSN)%');
1167+
1168+
$framework->messenger()
1169+
->routing('Symfony\Component\Mailer\Messenger\SendEmailMessage')
1170+
->senders(['async']);
1171+
};
1172+
11731173
11741174
Thanks to this, instead of being delivered immediately, messages will be sent to
11751175
the transport to be handled later (see :ref:`messenger-worker`).
@@ -1210,11 +1210,12 @@ disable asynchronous delivery.
12101210
.. code-block:: php
12111211
12121212
// config/packages/mailer.php
1213-
$container->loadFromExtension('framework', [
1214-
'mailer' => [
1215-
'message_bus' => 'app.another_bus',
1216-
],
1217-
]);
1213+
use Symfony\Config\FrameworkConfig;
1214+
1215+
return static function (FrameworkConfig $framework) {
1216+
$framework->mailer()
1217+
->messageBus('app.another_bus');
1218+
};
12181219
12191220
.. versionadded:: 5.1
12201221

@@ -1297,12 +1298,13 @@ the mailer configuration file (e.g. in the ``dev`` or ``test`` environments):
12971298
.. code-block:: php
12981299
12991300
// config/packages/mailer.php
1300-
$container->loadFromExtension('framework', [
1301+
use Symfony\Config\FrameworkConfig;
1302+
1303+
return static function (FrameworkConfig $framework) {
13011304
// ...
1302-
'mailer' => [
1303-
'dsn' => 'null://null',
1304-
],
1305-
]);
1305+
$framework->mailer()
1306+
->dsn('null://null');
1307+
};
13061308
13071309
.. note::
13081310

@@ -1349,14 +1351,15 @@ a specific address, instead of the *real* address:
13491351
.. code-block:: php
13501352
13511353
// config/packages/mailer.php
1352-
$container->loadFromExtension('framework', [
1354+
use Symfony\Config\FrameworkConfig;
1355+
1356+
return static function (FrameworkConfig $framework) {
13531357
// ...
1354-
'mailer' => [
1355-
'envelope' => [
1356-
'recipients' => ['[email protected]'],
1357-
],
1358-
],
1359-
]);
1358+
$framework->mailer()
1359+
->envelope()
1360+
->recipients(['[email protected]'])
1361+
;
1362+
};
13601363
13611364
.. _`high availability`: https://en.wikipedia.org/wiki/High_availability
13621365
.. _`load balancing`: https://en.wikipedia.org/wiki/Load_balancing_(computing)

notifier.rst

Lines changed: 53 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ configure the ``texter_transports``:
132132
133133
.. code-block:: php
134134
135-
# config/packages/notifier.php
136-
$container->loadFromExtension('framework', [
137-
'notifier' => [
138-
'texter_transports' => [
139-
'twilio' => '%env(TWILIO_DSN)%',
140-
],
141-
],
142-
]);
135+
// config/packages/notifier.php
136+
use Symfony\Config\FrameworkConfig;
137+
138+
return static function (FrameworkConfig $framework) {
139+
$framework->notifier()
140+
->texterTransport('twilio', '%env(TWILIO_DSN)%')
141+
;
142+
};
143143
144144
.. _notifier-chat-channel:
145145
.. _notifier-chatter-dsn:
@@ -224,14 +224,14 @@ Chatters are configured using the ``chatter_transports`` setting:
224224
225225
.. code-block:: php
226226
227-
# config/packages/notifier.php
228-
$container->loadFromExtension('framework', [
229-
'notifier' => [
230-
'chatter_transports' => [
231-
'slack' => '%env(SLACK_DSN)%',
232-
],
233-
],
234-
]);
227+
// config/packages/notifier.php
228+
use Symfony\Config\FrameworkConfig;
229+
230+
return static function (FrameworkConfig $framework) {
231+
$framework->notifier()
232+
->chatterTransport('slack', '%env(SLACK_DSN)%')
233+
;
234+
};
235235
236236
.. _notifier-email-channel:
237237

@@ -288,15 +288,16 @@ notification emails:
288288
289289
.. code-block:: php
290290
291-
# config/packages/mailer.php
292-
$container->loadFromExtension('framework', [
293-
'mailer' => [
294-
'dsn' => '%env(MAILER_DSN)%',
295-
'envelope' => [
296-
'sender' => '[email protected]',
297-
],
298-
],
299-
]);
291+
// config/packages/mailer.php
292+
use Symfony\Config\FrameworkConfig;
293+
294+
return static function (FrameworkConfig $framework) {
295+
$framework->mailer()
296+
->dsn('%env(MAILER_DSN)%')
297+
->envelope()
298+
->sender('[email protected]')
299+
;
300+
};
300301
301302
Configure to use Failover or Round-Robin Transports
302303
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -351,19 +352,19 @@ transport:
351352
352353
.. code-block:: php
353354
354-
# config/packages/notifier.php
355-
$container->loadFromExtension('framework', [
356-
'notifier' => [
357-
'chatter_transports' => [
358-
// Send notifications to Slack and use Telegram if
359-
// Slack errored
360-
'main' => '%env(SLACK_DSN)% || %env(TELEGRAM_DSN)%',
355+
// config/packages/notifier.php
356+
use Symfony\Config\FrameworkConfig;
361357
362-
// Send notifications to the next scheduled transport calculated by round robin
363-
'roundrobin' => '%env(SLACK_DSN)% && %env(TELEGRAM_DSN)%',
364-
],
365-
],
366-
]);
358+
return static function (FrameworkConfig $framework) {
359+
$framework->notifier()
360+
// Send notifications to Slack and use Telegram if
361+
// Slack errored
362+
->chatterTransport('main', '%env(SLACK_DSN)% || %env(TELEGRAM_DSN)%')
363+
364+
// Send notifications to the next scheduled transport calculated by round robin
365+
->chatterTransport('roundrobin', '%env(SLACK_DSN)% && %env(TELEGRAM_DSN)%')
366+
;
367+
};
367368
368369
Creating & Sending Notifications
369370
--------------------------------
@@ -495,23 +496,21 @@ specify what channels should be used for specific levels (using
495496
496497
.. code-block:: php
497498
498-
# config/packages/notifier.php
499-
$container->loadFromExtension('framework', [
500-
'notifier' => [
501-
// ...
502-
'channel_policy' => [
503-
// Use SMS, Slack and email for urgent notifications
504-
'urgent' => ['sms', 'chat/slack', 'email'],
505-
506-
// Use Slack for highly important notifications
507-
'high' => ['chat/slack'],
508-
509-
// Use browser for medium and low notifications
510-
'medium' => ['browser'],
511-
'low' => ['browser'],
512-
],
513-
],
514-
]);
499+
// config/packages/notifier.php
500+
use Symfony\Config\FrameworkConfig;
501+
502+
return static function (FrameworkConfig $framework) {
503+
// ...
504+
$framework->notifier()
505+
// Use SMS, Slack and email for urgent notifications
506+
->channelPolicy('urgent', ['sms', 'chat/slack', 'email'])
507+
// Use Slack for highly important notifications
508+
->channelPolicy('high', ['chat/slack'])
509+
// Use browser for medium and low notifications
510+
->channelPolicy('medium', ['browser'])
511+
->channelPolicy('medium', ['browser'])
512+
;
513+
};
515514
516515
Now, whenever the notification's importance is set to "high", it will be
517516
sent using the Slack transport::

security/remember_me.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ so ``DoctrineTokenProvider`` can store the tokens:
288288
289289
.. code-block:: php
290290
291-
# config/packages/doctrine.php
291+
// config/packages/doctrine.php
292292
$container->loadFromExtension('doctrine', [
293293
'dbal' => [
294294
'schema_filter' => '~^(?!rememberme_token)~',

0 commit comments

Comments
 (0)