axelhub/twilio

Axel's sms send package

Installs: 37

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:package

1.0 2023-07-22 10:09 UTC

This package is auto-updated.

Last update: 2024-05-15 05:40:09 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require

Twilio sms sender

Installation

composer require axelhub/twilio

After installing run command below. It will create twilio.php file in config folder.

php artisan twilio:install

Configure twilio.php file with Twilio key, secret, sid and from by adding variables below to your .env file:

TWILIO_APP_KEY=
TWILIO_APP_SECRET=
TWILIO_APP_SID=
TWILIO_APP_FROM=

Also, in the twilio.php file you can customize the list of countries where the app will be able to send messages. List of countries.

Using

Custom using

$twilio = new Twilio();
$twilio->sendSms($PhoneNumber, $Message);

Using with Laravel notification

More about laravel notifications.

Add SmsChannel::class class into via function in notification:

use Axel\Twilio\SmsChannel;

public function via($notifiable)
{
    return [SmsChannel::class];
}

Create toSms() function in notification class:

use Axel\Twilio\SmsMessage;

public function toSms($notifiable): SmsMessage
{
    return (new SmsMessage)
        ->to($PhoneNumber)
        ->message($Message);
}