\KorbaSMS

Class SMS help send messages.

Class to make use of Info SMS API service to send sms messages. It extends Class API. A class to help quickly make request to api endpoints. Only Content-Type application/json is supported. And methods currently supported are GET and POST.

Summary

Methods
Properties
Constants
__construct()
send()
No public properties found
No constants found
call()
$global_from
N/A
engine()
$base_url
$headers
$proxy_url
$proxy_auth
N/A

Properties

$global_from

$global_from : string|null

Type

string|null — Global recognition for source of message to avoid writing with each message sent.

$base_url

$base_url : string

Type

string — The base url of the api request endpoint.

$headers

$headers : array

Type

array — The headers that will be appended to each request.

$proxy_url

$proxy_url : string|null

Type

string|null — The proxy url to be used request.

$proxy_auth

$proxy_auth : string|null

Type

string|null — The proxy authentication in the form basic auth.

Methods

__construct()

__construct(string  $base_url, string  $username, string  $password, string|null  $global_from = null) 

SMS constructor.

It used to create a new instance of the SMS Class.

Parameters

string $base_url

INfobip Account Personal Base url.

string $username

Infobip Account Username.

string $password

Infobip Account Password.

string|null $global_from

Identification of the source of the SMS.

send()

send(string  $text, string  $to, string|null  $from = null) : boolean|string

SMS public function send.

It is used to send SMS

Parameters

string $text

Body of the SMS

string $to

Number of the recipient

string|null $from

Name of the send. if null will fallback to global_from

Returns

boolean|string

call()

call(string  $endpoint, string|array  $data, array  $extra_headers = null) : boolean|string

API protected function call.

A function used to make request to api endpoint. It clean the input data to a form suitable usable by the class

Parameters

string $endpoint

Endpoint to be used in addition to the base_url to construct full url path.

string|array $data

JsonEncoded string of the intended request data to send as the request body.

array $extra_headers

The result return after try to or connecting to the api endpoint.

Returns

boolean|string

engine()

engine(string  $end_point, string  $data = null, array  $extra_headers = null) : boolean|string

API private function engine.

A function used by the API class to actually make a curl request to the intended api endpoint.

Parameters

string $end_point

Endpoint to be used in addition to the base_url to construct full url path.

string $data

JsonEncoded string of the intended request data to send as the request body.

array $extra_headers

Any Extra headers that needs to be added to specific request.

Returns

boolean|string —

The result return after try to or connecting to the api endpoint.