parent
2b30d7d91d
commit
4f941ea83d
@ -0,0 +1,38 @@ |
|||||||
|
<?php |
||||||
|
|
||||||
|
declare(strict_types = 1); |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Robert Strutts <Bob_586@Yahoo.com> |
||||||
|
* @copyright (c) 2025, Robert Strutts |
||||||
|
* @license MIT |
||||||
|
*/ |
||||||
|
namespace CodeHydrater\services; |
||||||
|
|
||||||
|
use CodeHydrater\bootstrap\registry as Reg; |
||||||
|
|
||||||
|
final class twilio_setup { |
||||||
|
const VENDOR = CodeHydrater_PROJECT . 'vendor/twilio/sdk/src/Twilio/'; |
||||||
|
|
||||||
|
public static function init_sms($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 init_voice() { |
||||||
|
if (! Reg::get('loader')->is_loaded('Twilio')) { |
||||||
|
Reg::get('loader')->add_namespace('Twilio', self::VENDOR); |
||||||
|
return new \Twilio\TwiML\VoiceResponse(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue