From 64cb17811fc1083bc9c608a3bd7c33d486943ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Hern=C3=A1ndez=20Gil?= Date: Mon, 9 Dec 2013 20:52:03 +0100 Subject: [PATCH] Sms sending documentation --- README.md | 3 -- Resources/doc/index.md | 84 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 Resources/doc/index.md diff --git a/README.md b/README.md index f759918..13d1faa 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,3 @@ nexmo-bundle ============ Integrates Nexmo libs in Symfony2 -Reference ---------- -https://docs.nexmo.com/index.php/messaging-sms-api/send-message diff --git a/Resources/doc/index.md b/Resources/doc/index.md new file mode 100644 index 0000000..c511542 --- /dev/null +++ b/Resources/doc/index.md @@ -0,0 +1,84 @@ +JhgNexmoBundle +================== + +Integrates Nexmo 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 + \ No newline at end of file