Send an SMS with Thinwrap (PHP)

Send SMS via the Thinwrap unified Sms facade in PHP — same call shape for Twilio, Vonage, Plivo, and every other supported SMS provider.

1. Install

composer require thinwrap/notifications

2. Send the call

use Thinwrap\Notifications\Sms;
use Thinwrap\Notifications\Enum\NotificationProviderId;
use Thinwrap\Notifications\Providers\Twilio\TwilioConfig;
use Thinwrap\Notifications\DTO\Sms\SmsSendInput;

$sms = new Sms(
    NotificationProviderId::Twilio,
    new TwilioConfig(
        accountSid: getenv('TWILIO_ACCOUNT_SID'),
        authToken: getenv('TWILIO_AUTH_TOKEN'),
        from: '+15555550100',
    ),
);

$result = $sms->send(new SmsSendInput(
    to: '+15555550199',
    body: 'Your verification code is 123456',
));

echo $result->status, ' ', $result->providerMessageId ?? '(no id)', PHP_EOL;

Same code works for all supported providers — just change the provider ID.