Skip to content

Instantly share code, notes, and snippets.

@derduskenga
Created July 27, 2021 17:00
Show Gist options
  • Save derduskenga/94fef8c1c7c30120361f84e7df8e68db to your computer and use it in GitHub Desktop.
Save derduskenga/94fef8c1c7c30120361f84e7df8e68db to your computer and use it in GitHub Desktop.
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