tafhyseni/twilio-simple

SMS and Phone Calls by Twilio made easy!

1.0.0 2019-12-06 14:00 UTC

This package is auto-updated.

Last update: 2024-10-28 02:30:10 UTC


README

Latest Version on Packagist Build Status Quality Score Total Downloads

This is a helper package to help you using Twilio. Sending SMS and making Phone Calls has never been easier!

Installation

You can install the package via composer:

composer require tafhyseni/twilio-simple

Usage

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!';
}

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email tafhyseni@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

PHP Package Boilerplate

This package was generated using the PHP Package Boilerplate.