About
Mobilant is an ideal platform for sending sms, using this very simple API., (*1)
This is a composer package for using the Mobilant REST API. Have a look at their API docs for more details about all the parameters., (*2)
minimum configuration
Fastest possible usage for PHP 5.4+ using chaining for a fluent interface, (*3)
(new \Econic\Mobilant\SMS)
->setKey('myTokenKey123')
->setMessage('hello world')
->setTo('0049987123456')
->setFrom('Bob')
->setRoute('lowcostplus')
->send();
Fastest possible usage for < PHP 5.4 and without using chaining, (*4)
$mobilant = new \Econic\Mobilant\SMS();
$mobilant->setKey('myTokenKey123');
$mobilant->setMessage('hello world');
$mobilant->setTo('0049987123456');
$mobilant->setFrom('Bob');
$mobilant->setRoute('lowcostplus');
$mobilant->send();
Methods
Every setter returns the object again to enable chaining and has a respective getter, (*5)
setKey
Your app API key, (*6)
setMessage
The message of the sms, (*7)
setTo
The receiver's phone number, (*8)
setFrom
The sender name, (*9)
setRoute
The route to choose, (*10)
setCharset
The encoding of the string you pass into setMessage()
and setFrom()
, (*11)
setRef
The reference to save with the message, (*12)
setConcat
If the message should be concatenated when > 160 chars, (*13)
setSenddate
The date to send if you want to time it for later, (*14)
setDebug
If you want to act as if you'd drop a message but don't want it to be sent, (*15)
send
Send the text message, (*16)
Returns array with two indexes:, (*17)
'success' => true if the message was sent successfully, otherwise false, (*18)
'response' => An array with the data returned by the mobilant api if the message was sent successfully, otherwise null. Indexes are responsecode, message_id, cost, count, (*19)