axelhub / twilio
Axel's sms send package
Installs: 47
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:package
Requires
- php: >=8.0
- laravel/framework: ^10
- twilio/sdk: ^7.5
README
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); }