oclock/twilio-messenger

The Laravel Twilio SMS package provides a seamless integration of the Twilio SMS/Whatsapp service into your Laravel applications. With this package, you can easily send SMS/Whatsapp messages using the powerful Twilio PHP SDK without the need for extensive manual configuration.

1.0.1 2023-11-23 12:01 UTC

This package is auto-updated.

Last update: 2024-04-24 11:00:21 UTC


README

This is sample Laravel Package to be used to use twilio/sdk services

Getting started

composer require oclock/twilio-messenger

Update .ENV

TWILIO_SID=xxxxxxxxxxxx
TWILIO_TOKEN=xxxxxxxxxx
TWILIO_FROM_NUMBER=+xxxxxx
TWILIO_WHATSAPP=+xxxxxxx

Add the below code to app.php under service prodiver if not discovered automatically in Lower versions of laravel

Oclock\TwilioMessenger\TwilioServiceProvider::class

Sample Code

namespace App\Http\Controllers; 

use Illuminate\Http\Request; 
use Oclock\TwilioMessenger\TwilioService; 

class HomeController extends Controller 
{
    //
    public function index(Request $request, TwilioService $twilio)
    {
        if($request->phonenumber && $request->message){
            $media = 'Your media url';
            $send =  $twilio->sendWhatsapp($request->phonenumber, $request->message, $media);
        }
        
    }
}