misaf/laravel-sms-gateway-twilio

Twilio SMS gateway driver for Laravel.

Maintainers

Package info

github.com/misaf/laravel-sms-gateway-twilio

pkg:composer/misaf/laravel-sms-gateway-twilio

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v3.0.0 2026-07-04 09:54 UTC

This package is auto-updated.

Last update: 2026-07-04 09:55:06 UTC


README

Twilio SMS gateway driver for misaf/laravel-sms-gateway.

Installation

composer require misaf/laravel-sms-gateway-twilio

Laravel package discovery registers the driver service provider automatically.

Configuration

SMS_GATEWAY_DRIVER=twilio
SMS_GATEWAY_TWILIO_ACCOUNT_SID=your-account-sid
SMS_GATEWAY_TWILIO_AUTH_TOKEN=your-auth-token
// config/services.php
'twilio' => [
    'account_sid' => env('SMS_GATEWAY_TWILIO_ACCOUNT_SID'),
    'auth_token'  => env('SMS_GATEWAY_TWILIO_AUTH_TOKEN'),
    'base_url' => env('SMS_GATEWAY_TWILIO_BASE_URL'),
],

By default, the account SID is included in the base URL path. If you override base_url, include the account-specific path segment expected by Twilio.

Driver Behavior

Option Value
Driver name twilio
Default base URL https://api.twilio.com/2010-04-01/Accounts/{account_sid}/
send() endpoint POST Messages.json
Authentication HTTP Basic auth from services.twilio.account_sid and services.twilio.auth_token
Payload Form data sent directly to Twilio

Usage

use Misaf\LaravelSmsGateway\Facade\SmsGateway;

$response = SmsGateway::driver('twilio')->send([
    'To'   => '+15005550006',
    'From' => '+15005550001',
    'Body' => 'Here is a test message.',
]);

The payload is passed directly to Twilio, so use the fields expected by the Twilio API.

Use request() when you need direct access to Laravel's HTTP client:

$request = SmsGateway::driver('twilio')->request();

Testing

composer test
composer analyse

License

MIT