This is a helper package to help you using Twilio. Sending SMS and making Phone Calls has never been easier!
You can install the package via composer:
composer require tafhyseni/twilio-simple
Send a SMS to a specified phone number
use Tafhyseni\TwilioSimple\RequestTwilio;
$twilio = new RequestTwilio(
'YOUR_twilio_SID',
'YOUR_twilio_TOKEN',
'YOUR_twilio_verified_number'
);
$twilio->setSMS('This is my SMS message body');
if(!$twilio->sendSMS('PHONE_NUMBER_HERE'))
{
// An error happened.
echo $twilio->getError(); // getError() will return the error message!
}else{
// message sent/queued
echo $twilio->countSMS(); // countSMS() will return the number of sms sent.
}
Make a call to a phone number and say something
use Tafhyseni\TwilioSimple\RequestTwilio;
$twilio = new RequestTwilio(
'YOUR_twilio_SID',
'YOUR_twilio_TOKEN',
'YOUR_twilio_verified_number'
);
$twilio->setSMS('Hello, this call is made from Twilio Simple Package!');
if(!$twilio->makeCall('PHONE_NUMBER_HERE'))
{
echo 'Error:' . $twilio->getError();
}else{
echo 'Call Done!';
}
composer test
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.
This package was generated using the PHP Package Boilerplate.