symfony/message-media-notifier

Symfony MessageMedia Notifier Bridge

Installs: 1 148

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 4

Forks: 3

Type:symfony-notifier-bridge

v7.0.3 2024-01-23 15:02 UTC

README

Provides MessageMedia integration for Symfony Notifier.

DSN example

MESSAGEMEDIA_DSN=messagemedia://API_KEY:API_SECRET@default?from=FROM

where:

  • API_KEY is your API key
  • API_SECRET is your API secret
  • 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.

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