PHP Class SimpleSoftwareIO\SMS\Drivers\ZenviaSMS

Inheritance: extends AbstractSMS, implements SimpleSoftwareIO\SMS\Drivers\DriverInterface
Show file Open project: simplesoftwareio/simple-sms

Protected Properties

Property Type Description
$apiBase string The API's URL.
$callbackOption string The callbackOption to receive message delivery notifications.
$client GuzzleHttp\Client The Guzzle HTTP Client.

Public Methods

Method Description
__construct ( Client $client, $accountKey, $passCode, string $callbackOption = 'NONE' ) ZenviaSMS constructor.
checkMessages ( array $options = [] ) : array Checks the server for messages and returns their results.
getMessage ( integer | string $messageId ) : IncomingMessage Gets a single message by it's ID.
receive ( mixed $raw ) : IncomingMessage Receives an incoming message via REST call.
send ( OutgoingMessage $message ) Sends a SMS message.

Protected Methods

Method Description
getRequest ( ) : mixed Creates and sends a GET request to the requested URL.
postRequest ( ) : mixed Creates and sends a POST request to the requested URL.
processReceive ( $rawMessage ) : IncomingMessage Parse a response from messageId check and returns a Message.

Private Methods

Method Description
generateMessageBody ( $from, $number, $composeMessage ) : array Message body generator based on the attributes.

Method Details

__construct() public method

ZenviaSMS constructor.
public __construct ( Client $client, $accountKey, $passCode, string $callbackOption = 'NONE' )
$client GuzzleHttp\Client
$accountKey
$passCode
$callbackOption string

checkMessages() public method

Checks the server for messages and returns their results.
public checkMessages ( array $options = [] ) : array
$options array
return array

getMessage() public method

Gets a single message by it's ID.
public getMessage ( integer | string $messageId ) : IncomingMessage
$messageId integer | string
return SimpleSoftwareIO\SMS\IncomingMessage

getRequest() protected method

Creates and sends a GET request to the requested URL.
protected getRequest ( ) : mixed
return mixed

postRequest() protected method

Creates and sends a POST request to the requested URL.
protected postRequest ( ) : mixed
return mixed

processReceive() protected method

Parse a response from messageId check and returns a Message.
protected processReceive ( $rawMessage ) : IncomingMessage
$rawMessage
return SimpleSoftwareIO\SMS\IncomingMessage

receive() public method

Contact Zenvia Support to get this enabled to your account before using.
public receive ( mixed $raw ) : IncomingMessage
$raw mixed
return SimpleSoftwareIO\SMS\IncomingMessage

send() public method

Sends a SMS message.
public send ( OutgoingMessage $message )
$message SimpleSoftwareIO\SMS\OutgoingMessage

Property Details

$apiBase protected property

The API's URL.
protected string $apiBase
return string

$callbackOption protected property

The callbackOption to receive message delivery notifications.
protected string $callbackOption
return string

$client protected property

The Guzzle HTTP Client.
protected Client,GuzzleHttp $client
return GuzzleHttp\Client