An unofficial SMSTools transport for Symfony Notifier.
composer require gijsrommers/smstools-notifierConfigure 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.
Install Symfony Webhook if it is not already present:
composer require symfony/webhookRegister 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.
composer install
composer testMIT. This package is community-maintained and is not an official SMSTools product.