Class dosamigos\nexmo\Client

Inheritancedosamigos\nexmo\Client » yii\base\Component
Subclassesdosamigos\nexmo\Account, dosamigos\nexmo\Sms
Class Client is the base class of Components that access the API and handles the calls to the API base end point.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$api string API endpoint dosamigos\nexmo\Client
$format string Response format. dosamigos\nexmo\Client
$key string Your API key dosamigos\nexmo\Client
$secret string Your API secret dosamigos\nexmo\Client

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$uri string The formed uri by child classes dosamigos\nexmo\Client

Public Methods

Hide inherited methods

MethodDescriptionDefined By
init() Initializes the object. dosamigos\nexmo\Client

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
getGuzzleClient() Returns the guzzle client dosamigos\nexmo\Client
request() Makes a Url request and returns its response dosamigos\nexmo\Client
validateUTF8() Validates whether the value is UTF8 encoded and if not, it encodes it. dosamigos\nexmo\Client

Property Details

$api public property
string $api 'https://rest.nexmo.com'

API endpoint

$format public property
string $format 'json'

Response format. Can be json or xml.

$key public property
string $key null

Your API key

$secret public property
string $secret null

Your API secret

$uri protected property
string $uri null

The formed uri by child classes

Method Details

getGuzzleClient() protected method

Returns the guzzle client

\GuzzleHttp\Client getGuzzleClient( )
init() public method

Initializes the object.

This method is invoked at the end of the constructor after the object is initialized with the given configuration.

void init( )
throws \yii\base\InvalidConfigException
request() protected method

Makes a Url request and returns its response

mixed|null request$url$params = [], $options = [] )
$url string

The uri to call

$params array

The parameters to be bound to the call

$options array

The options to be attached to the client

validateUTF8() protected method

Validates whether the value is UTF8 encoded and if not, it encodes it.

From Nexmo Docs: All requests are submitted through the HTTP POST or GET method using UTF-8 encoding and URL encoded values.

string validateUTF8$value )
$value string