Skip to content

[Notifier] Add options parameter to SmsMessage #18557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions notifier.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,19 @@ send SMS messages::
#[Route('/login/success')]
public function loginSuccess(TexterInterface $texter)
{
$options = (new ProviderOptions())
->setPriority('high')
;

$sms = new SmsMessage(
// the phone number to send the SMS message to
'+1411111111',
// the message
'A new login was detected!',
// optionally, you can override default "from" defined in transports
'+1422222222',
// you can also add options object implementing MessageOptionsInterface
$options
);

$sentMessage = $texter->send($sms);
Expand All @@ -202,6 +208,10 @@ send SMS messages::

The 3rd argument of ``SmsMessage`` (``$from``) was introduced in Symfony 6.2.

.. versionadded:: 6.3

The 4th argument of ``SmsMessage`` (``$options``) was introduced in Symfony 6.3.

The ``send()`` method returns a variable of type
:class:`Symfony\\Component\\Notifier\\Message\\SentMessage` which provides
information such as the message ID and the original message contents.
Expand Down