PHP Class SimpleSoftwareIO\SMS\Drivers\NexmoSMS

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

Protected Properties

Property Type Description
$apiBase string The API's URL.
$apiEnding array The ending of the URL that all requests must have.
$apiKey string The API key.
$apiSecret string The API secret key.
$client GuzzleHttp\Client The Guzzle HTTP Client.

Public Methods

Method Description
__construct ( Client $client, $apiKey, $apiSecret ) Create the CallFire instance.
checkMessages ( array $options = [] ) : array Checks the server for messages and returns their results.
getMessage ( string | integer $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
getFirstMessage ( $body ) Get the first message in the response from Nexmo
handleError ( $body ) Log the error message which ocurred
hasAResponseMessage ( $body ) Check for a message in the response from Nexmo
hasError ( $body ) : boolean Checks if the transaction has an error
hasProperty ( $message, $property ) : boolean Check if the message from Nexmo has a given property
processReceive ( $rawMessage ) : mixed Creates many IncomingMessage objects and sets all of the properties.

Method Details

__construct() public method

Create the CallFire instance.
public __construct ( Client $client, $apiKey, $apiSecret )
$client GuzzleHttp\Client The Guzzle Client

checkMessages() public method

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

getFirstMessage() protected method

Get the first message in the response from Nexmo
protected getFirstMessage ( $body )
$body

getMessage() public method

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

handleError() protected method

Log the error message which ocurred
protected handleError ( $body )
$body

hasAResponseMessage() protected method

Check for a message in the response from Nexmo
protected hasAResponseMessage ( $body )
$body

hasError() protected method

Checks if the transaction has an error
protected hasError ( $body ) : boolean
$body
return boolean

hasProperty() protected method

Check if the message from Nexmo has a given property
protected hasProperty ( $message, $property ) : boolean
$message
$property
return boolean

processReceive() protected method

Creates many IncomingMessage objects and sets all of the properties.
protected processReceive ( $rawMessage ) : mixed
$rawMessage
return mixed

receive() public method

Receives an incoming message via REST call.
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_oe property

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

$apiEnding protected_oe property

The ending of the URL that all requests must have.
protected array $apiEnding
return array

$apiKey protected_oe property

The API key.
protected string $apiKey
return string

$apiSecret protected_oe property

The API secret key.
protected string $apiSecret
return string

$client protected_oe property

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