Skip to content

Instantly share code, notes, and snippets.

@derduskenga
Created Jul 27, 2021
Embed
What would you like to do?
sms.php
<?php
require 'vendor/autoload.php';
use AfricasTalking\SDK\AfricasTalking;
include_once 'util.php';
class Sms {
protected $AT;
function __construct()
{
$this->AT = new AfricasTalking(Util::$API_USERNAME, Util::$API_KEY);
}
public function sendSms($message, $recipients){
//get the sms service
//$sms = $this->AT->sms();
$sms = $this->AT->sms();
//use the SMS service to send SMS
$result = $sms->send([
'to' => $recipients,
'message' => $message,
'from' => Util::$COMPANY_NAME
]);
return $result;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment