shaz3e/twilio

Send SMS with Twilio in your Laravel Application

v1.1.0 2024-12-17 14:02 UTC

This package is auto-updated.

Last update: 2025-05-17 15:00:05 UTC


README

Packagist Version Packagist Downloads License Laravel Version

Introduction

This is a Laravel package for sending SMS with Twilio

Installation

You can install the package via composer by running the following command in your terminal

composer require shaz3e/twilio

Publishing Configurations

Publish config only

php artisan vendor:publish --tag=twilio-config

This is the content of the config file that will be published at config/twilio.php

<?php

return [
    'twilio_sid' => env('TWILIO_ACCOUNT_SID'),
    'twilio_token' => env('TWILIO_AUTH_TOKEN'),
    'twilio_from' => env('TWILIO_SMS_FROM'),
];

Update .env file

Next, edit your .env file with your Twilio Credentials TWILIO_ACCOUNT_SID=xxxxx TWILIO_AUTH_TOKEN=xxxxx TWILIO_SMS_FROM=+xxxxx

Usage

To send a SMS message, you can use the notify() method available on the Twilio Facade

<?php

use Shaz3e\Twilio\Facades\Twilio;

$sendSms = Twilio::notify('+123456789', 'Hello')

return $sendSms;

To send WhatsAp message you can use the notifyWhatsApp method available on the Twilio Facade

<?php

use Shaz3e\Twilio\Facades\Twilio;

$sendWhatsApp = Twilio::notifyWhatsApp('+123456789', 'Hello')

return $sendWhatsApp;

Contributing

License

Twilio is licensed under the MIT license. Enjoy!

Credit

GitHub commit activity

GitHub Stats

GitHub Contributions Graph