symfony/message-media-notifier

Symfony MessageMedia Notifier Bridge

Installs: 5 442

Dependents: 1

Suggesters: 0

Security: 0

Stars: 6

Watchers: 4

Forks: 3

Type:symfony-notifier-bridge


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