Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMSTools Notifier

An unofficial SMSTools transport for Symfony Notifier.

Installation

composer require gijsrommers/smstools-notifier

Configure the transport:

SMS_TOOLS_DSN=smstools://CLIENT_ID:CLIENT_SECRET@default?from=MyApp
# config/packages/notifier.yaml
framework:
    notifier:
        texter_transports:
            smstools: '%env(SMS_TOOLS_DSN)%'

Symfony Flex enables SmstoolsNotifierBundle and creates this configuration automatically. Applications without Flex can enable the bundle manually in config/bundles.php.

Send an SMS using Symfony's standard API:

use Symfony\Component\Notifier\Message\SmsMessage;
use Symfony\Component\Notifier\TexterInterface;

$texter->send(new SmsMessage('32470123456', 'Hello from Symfony!'));

The from value in an individual SmsMessage overrides the sender configured in the DSN. URL-encode credentials containing reserved URI characters.

Delivery webhooks

Install Symfony Webhook if it is not already present:

composer require symfony/webhook

Register the parser and configure a webhook route with the signing secret shown by SMSTools:

# config/services.yaml
services:
    GijsRommers\SmstoolsNotifier\Webhook\SmstoolsRequestParser: ~
# config/packages/webhook.yaml
framework:
    webhook:
        routing:
            smstools:
                service: GijsRommers\SmstoolsNotifier\Webhook\SmstoolsRequestParser
                secret: '%env(SMS_TOOLS_WEBHOOK_SECRET)%'

Point the SMSTools webhook at /webhook/smstools. The parser validates the X-Smstools-Timestamp and X-Smstools-Signature headers against the unmodified request body and rejects signatures older than five minutes. Delivery reports with terminal delivered/not-delivered codes are exposed as Symfony SmsEvent instances. Intermediate reports and other authenticated SMSTools events remain available as generic RemoteEvent instances.

Development

composer install
composer test

License

MIT. This package is community-maintained and is not an official SMSTools product.

About

Unofficial SMSTools transport and webhook parser for Symfony Notifier

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages