PHP code example of zepson / africastalking

1. Go to this page and download the library: Download zepson/africastalking 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/ */

    

zepson / africastalking example snippets


use zepson\africastalking\AfricasTalking;

#UPDATE YOUR .ENV FILE WITH YOUR AFRICAS TALKING CREDENTIALS

 add-license-1

AFRICASTALKING_APP_USERNAME = "YOUR AFRICA IS TALKING APP NAME"
AFRICASTALKING_APP_API_KEY = " YOUR APP URL"
AFRICASTALKING_APP_SENDER_ID= ""       // Set your shortCode or senderId
#instantiate your servece as
$AT       = new AfricasTalking();

// Get one of the services
$sms      = $AT->sms();

// Use the service
$result   = $sms->send([
    'to'      => '+2XXYYYOOO',
    'message' => 'Hello World!'
]);

print_r($result);

$voiceActions = $voice->messageBuilder();
$xmlresponse = $voiceActions
    ->getDigits($options)
    ->say($text)
    ->record()
    ->build();