Sms sending documentation

This commit is contained in:
Javier Hernández Gil 2013-12-09 20:52:03 +01:00
parent 94b4d1b1ea
commit 64cb17811f
2 changed files with 84 additions and 3 deletions

View File

@ -2,6 +2,3 @@ nexmo-bundle
============
Integrates Nexmo libs in Symfony2
Reference
---------
https://docs.nexmo.com/index.php/messaging-sms-api/send-message

84
Resources/doc/index.md Normal file
View File

@ -0,0 +1,84 @@
JhgNexmoBundle
==================
Integrates <a href="https://www.nexmo.com/">Nexmo</a> services in Symfony2. You require an API key/secret pair (you can try it for free).
Installation
------------
Add this bundle to your `composer.json` file:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/javihernandezgil/nexmo-bundle.git"
}
],
"require": {
"javihernandezgil/nexmo-bundle": "dev-master"
}
}
Register the bundle in 'app/AppKernel.php':
// app/AppKernel.php
public function registerBundles()
{
return array(
// ...
new Jhg\NexmoBundle\JhgNexmoBundle(),
);
}
Configuration
-------------
Configure your app config in `app/config/parameters.yml`.
# app/config/parameters.yml
nexmo_api_key: your_nexmo_api_key
nexmo_api_secret: your_nexmo_api_key
nexmo_from_name: App Name
If you want distribute your app in `app/config/parameters.yml.dist` too:
# app/config/parameters.yml.dist
nexmo_api_key: ~
nexmo_api_secret: ~
nexmo_from_name: ~
Enable the bundle's configuration in `app/config/config.yml`:
# app/config/config.yml
jhg_nexmo:
api_key: %nexmo_api_key%
api_secret: %nexmo_api_secret%
from_name: %nexmo_from_name%
Usage
-----
### Send SMS with service
$sender = $this->getContainer()->get('jhg_nexmo.sms.sender');
$sender->send($number,$fromName,$message);
If no $fromName is provided 'jhg_nexmo.from_name' is used. This from name is limited to 11 characters (spaces and special chars are not allowed).
### Send SMS with command
You can send a SMS message using the proviced command
php app/console nexmo:sms:send +34666555444 MyApp "Hello World!!"
Reference
---------
https://docs.nexmo.com/index.php/messaging-sms-api/send-message