You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
975 B

<?php
declare(strict_types = 1);
/**
* @author Robert Strutts <Bob_586@Yahoo.com>
* @copyright (c) 2025, Robert Strutts
* @license MIT
*/
namespace IOcornerstone\Framework\Services;
use IOcornerstone\Framework\Registry as Reg;
final class TwilioSetup {
const VENDOR = IO_CORNERSTONE_PROJECT . 'vendor/twilio/sdk/src/Twilio/';
public static function initSms($sid, $token) {
if (! Reg::get('loader')->is_loaded('Twilio')) {
Reg::get('loader')->add_namespace('Twilio', self::VENDOR);
}
if ($sid === false) {
throw new \Exception("Twilio SID not defined");
}
if ($token === false) {
throw new \Exception("Twilio TOKEN not defined");
}
return new \Twilio\Rest\Client($sid, $token);
}
public static function initVoice() {
if (! Reg::get('loader')->is_loaded('Twilio')) {
Reg::get('loader')->add_namespace('Twilio', self::VENDOR);
return new \Twilio\TwiML\VoiceResponse();
}
}
}