This is a Laravel4 package that helps you integrate Nexmo sms services into your site.
This is a work in progress so right now these are the function available:
- Get Account Balance
- Get Prices and Carriers
- Send SMS
You can install this package through Composer. Edit your composer.json file and add christian-giupponi/nexmo
to the required:
"require" : {
"christian-giupponi/nexmo": "dev-master"
}
ext, update Composer from the Terminal:
composer update
Now you have to add the Service Provider so edit your app/config/app.php file and in the providers array add:
'ChristianGiupponi\Nexmo\NexmoServiceProvider'
Now add the Facade in aliases array:
'Nexmo' => 'ChristianGiupponi\Nexmo\Facades\Nexmo',
You also need to pusblish the config file to add your own api and secret key that you can find on your Nexmo's dashboard:
php artisan config:publish christian-giupponi/nexmo
And you're done. Now you can call nexmo package using
Nexmo::getBalance();
Nexmo::prices();
Nexmo::sendSMS($from, $to, $text, $options);
All the function of this package will return a json result. It is made with 3 fiedls:
1. code
2. reason
3. body
This fields will return an http code status that is generated by the http request and represent the result of the api call, is not the code returned from Nexmo.
It is generated by the Guzzle client and you can check if the request is correct.
Like the above it is generated by Gruzzle and contains the result of the api request, not the response from Nexmo.
In this fild you can check if there are any errors, like malformed request.
This is a Json result sent by Nexmo after we call its api
If you find any issue please post it here on GitHub, fell free to fork and add any new api call that you need and then please make a pull request to keep this project updated.