PHP code example of tafhyseni / twilio-simple

1. Go to this page and download the library: Download tafhyseni/twilio-simple library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tafhyseni / twilio-simple example snippets

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