8000 [Notifier] Document Notifier options in README files by alamirault · Pull Request #50349 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Notifier] Document Notifier options in README files #50349

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
Show file tree
Hide file tree
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
29 changes: 29 additions & 0 deletions src/Symfony/Component/Notifier/Bridge/AllMySms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,35 @@ where:
- `APIKEY` is your AllMySms API key
- `FROM` is your sender (optional, default: 36180)

Adding Options to a Message
---------------------------

With a AllMySms Message, you can use the `AllMySmsOptions` class to add
[message options](https://doc.allmysms.com/api/allmysms_api_https_v9.0_EN.pdf).

```php
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Bridge\AllMySms\AllMySmsOptions;

$sms = new SmsMessage('+1411111111', 'My message');

$options = (new AllMySmsOptions())
->alerting(1)
->campaignName('API')
->cliMsgId('test_cli_msg_id')
->date('2023-05-23 23:47:25')
->simulate(1)
->uniqueIdentifier('unique_identifier')
->verbose(1)
// ...
;

// Add the custom options to the sms message and send the message
$sms->options($options);

$texter->send($sms);
```

Resources
---------

Expand Down
8000
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function getRecipientId(): ?string
/**
* @return $this
*/
public function diffusionName(int $diffusionName): static
public function diffusionName(string $diffusionName): static
{
$this->options['diffusion_name'] = $diffusionName;

Expand Down
24 changes: 24 additions & 0 deletions src/Symfony/Component/Notifier/Bridge/ContactEveryone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,30 @@ This bridge uses the light version of Contact Everyone API.

See your account info at https://contact-everyone.orange-business.com/#/login

Adding Options to a Message
---------------------------

With a Contact everyone Message, you can use the `ContactEveryoneOptions` class to add
message options.

```php
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Bridge\ContactEveryone\ContactEveryoneOptions;

$sms = new SmsMessage('+1411111111', 'My message');

$options = (new ContactEveryoneOptions())
->diffusionName('My label')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the method should be changed to accept a string also (would be consistent with the constructor of the transport)
@franckranaivo where can I find the doc that tells about this parameter?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, for the late answer. I picked these parameters (including diffusionName) from their manuals. But yes it should accept string. Here is the manual, idk if there is an english version.
https://ceo-be.multimediabs.com/attachments/hosted/lightApiManualsFR
They start to talk about these on page 9.

Apparently, it is useful for categorizing sms logs.

->category('my-category')
// ...
;

// Add the custom options to the sms message and send the message
$sms->options($options);

$texter->send($sms);
```

Resources
---------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public function testContactEveryoneOptions()
{
$contactEveryoneOptions = (new ContactEveryoneOptions())
->category('test_category')
->diffusionName(123);
->diffusionName('test_diffusion_name');

self::assertSame([
'category' => 'test_category',
'diffusion_name' => 123,
'diffusion_name' => 'test_diffusion_name',
], $contactEveryoneOptions->toArray());
}
}
22 changes: 22 additions & 0 deletions src/Symfony/Component/Notifier/Bridge/Esendex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,28 @@ where:

See Esendex documentation at https://developers.esendex.com/api-reference#smsapis

Adding Options to a Message
---------------------------

With an Esendex Message, you can use the `EsendexOptions` class to add message options.

```php
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Bridge\Esendex\EsendexOptions;

$sms = new SmsMessage('+1411111111', 'My message');

$options = (new EsendexOptions())
->accountReference('account_reference')
// ...
;

// Add the custom options to the sms message and send the message
$sms->options($options);

$texter->send($sms);
```

Resources
---------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function getRecipientId(): ?string
/**
* @return $this
*/
public function class(int $class): static
public function class(string $class): static
{
$this->options['class'] = $class;

Expand Down
25 changes: 25 additions & 0 deletions src/Symfony/Component/Notifier/Bridge/GatewayApi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,31 @@ where:

See your account info at https://gatewayapi.com

Adding Options to a Message
---------------------------

With a GatewayApi Message, you can use the `GatewayApiOptions` class to add
[message options](https://gatewayapi.com/docs/apis/rest/).

```php
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Bridge\GatewayApi\GatewayApiOptions;

$sms = new SmsMessage('+1411111111', 'My message');

$options = (new GatewayApiOptions())
->class('standard')
->callbackUrl('https://my-callback-url')
->userRef('user_ref')
// ...
;

// Add the custom options to the sms message and send the message
$sms->options($options);

$texter->send($sms);
```

Resources
---------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ class GatewayApiOptionsTest extends TestCase
public function testGatewayApiOptions()
{
$gatewayApiOptions = (new GatewayApiOptions())
->class(123)
->class('test_class')
->callbackUrl('test_callback_url')
->userRef('test_user_ref');

self::assertSame([
'class' => 123,
'class' => 'test_class',
'callback_url' => 'test_callback_url',
'userref' => 'test_user_ref',
], $gatewayApiOptions->toArray());
Expand Down
34 changes: 34 additions & 0 deletions src/Symfony/Component/Notifier/Bridge/MessageBird/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,40 @@ where:
- `TOKEN` is your MessageBird token
- `FROM` is your sender

Adding Options to a Message
---------------------------

With a MessageBird Message, you can use the `MessageBirdOptions` class to add
[message options](https://developers.messagebird.com/api/sms-messaging/#send-outbound-sms).

```php
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Bridge\MessageBird\MessageBirdOptions;

$sms = new SmsMessage('+1411111111', 'My message');

$options = (new MessageBirdOptions())
->type('test_type')
->scheduledDatetime('test_scheduled_datetime')
->createdDatetime('test_created_datetime')
->dataCoding('test_data_coding')
->gateway(999)
->groupIds(['test_group_ids'])
->mClass(888)
->reference('test_reference')
->reportUrl('test_report_url')
->shortenUrls(true)
->typeDetails('test_type_details')
->validity(777)
// ...
;

// Add the custom options to the sms message and send the message
$sms->options($options);

$texter->send($sms);
```

Resources
---------

Expand Down
30 changes: 30 additions & 0 deletions src/Symfony/Component/Notifier/Bridge/MessageMedia/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,36 @@ where:
- `FROM` is your registered sender ID (optional). Accepted values: 3-15 letters, could be alpha tag, shortcode or international phone number.
When phone number starts with a `+` sign, it needs to be url encoded in the DSN

Adding Options to a Message
---------------------------

With a MessageMedia Message, you can use the `MessageMediaOptions` class to add
[message options](https://messagemedia.github.io/documentation/#tag/Messages/operation/SendMessages).

```php
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Bridge\MessageMedia\MessageMediaOptions;

$sms = new SmsMessage('+1411111111', 'My message');

$options = (new MessageMediaOptions())
->media(['media'])
->callbackUrl('callback_url')
->format('format')
->deliveryReport(true)
->expiry(999)
->metadata(['metadata'])
->scheduled('scheduled')
->subject('subject');
// ...
;

// Add the custom options to the sms message and send the message
$sms->options($options);

$texter->send($sms);
```

Resources
---------

Expand Down
25 changes: 25 additions & 0 deletions src/Symfony/Component/Notifier/Bridge/Termii/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,31 @@ where:
- `FROM` is your sender
- `CHANNEL` is your channel (generic, dnd, whatsapp)

Adding Options to a Message
---------------------------

With a Termii Message, you can use the `TermiiOptions` class to add
[message options](https://developer.termii.com/messaging#send-message).

```php
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Bridge\Termii\TermiiOptions;

$sms = new SmsMessage('+1411111111', 'My message');

$options = (new TermiiOptions())
->type('test_type')
->channel('test_channel')
->media('test_media_url', 'test_media_caption')
// ...
;

// Add the custom options to the sms message and send the message
$sms->options($options);

$texter->send($sms);
```

Resources
---------

Expand Down
22 changes: 22 additions & 0 deletions src/Symfony/Component/Notifier/Bridge/Twilio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,28 @@ where:
- `TOKEN` is your Twilio token
- `FROM` is your sender

Adding Options to a Message
---------------------------

With a Twilio Message, you can use the `TwilioOptions` class to add message options.

```php
use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\Bridge\Twilio\TwilioOptions;

$sms = new SmsMessage('+1411111111', 'My message');

$options = (new TwilioOptions())
->webhookUrl('test_webhook_url')
// ...
;

// Add the custom options to the sms message and send the message
$sms->options($options);

$texter->send($sms);
```

Resources
---------

Expand Down
0