The Nexmo library for the Yii framework
Nexmo Library allows Yii programmers to use the Restful API offered by Mobile Messaging provider Nexmo.
Nexmo is a cloud-based SMS API that lets you send and receive high volume of messages at wholesale rates.
The preferred way to install this extension is through composer.
php composer.phar require "2amigos/yii2-nexmo-library" "*"
"2amigos/yii2-nexmo-library" : "*"
to the require section of your application's
First you have to create your [Nexmo account](Nexmo API credentials) and get your API_KEY and API_SECRET.
// to send an sms message $sms = new dosamigos\Sms(['key' => 'API_KEY', 'secret' => 'API_SECRET', 'from' => 'SENDERID']); // lets call the API to get a json response $sms->format = 'json'; // send a message with an optional parameter (see Nexmo doc for more optional parameters) $response = $sms->sentText('RECIPIENTSNUMBER', 'Hello World!', ['clientRef' => 'YOURCLIENTREF']); // if a response expects a JSON object, it will return as an array, if format was a XML, it will return an object. echo $response['message-count']; // the number of parts the message was split into
For further information regarding Nexmo, please visit its documentation
Web development has never been so fun!