From 49acd327501a00f8ec7691ef18f0dfea515c1600 Mon Sep 17 00:00:00 2001 From: Knight Tan Date: Tue, 9 Jun 2015 00:03:15 +0800 Subject: [PATCH 1/3] make it work under Laravel 5 --- composer.json | 2 +- src/Artistan/Nexmo/NexmoServiceProvider.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index bee95e1..f2c0b57 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ ], "require": { "php": ">=5.3.0", - "illuminate/support": "4.*" + "illuminate/support": "5.*" }, "require-dev":{ "phpunit/phpunit": "3.7.*", diff --git a/src/Artistan/Nexmo/NexmoServiceProvider.php b/src/Artistan/Nexmo/NexmoServiceProvider.php index 253d7b0..171f400 100644 --- a/src/Artistan/Nexmo/NexmoServiceProvider.php +++ b/src/Artistan/Nexmo/NexmoServiceProvider.php @@ -21,7 +21,7 @@ class NexmoServiceProvider extends ServiceProvider { */ public function boot() { - $this->package('artistan/nexmo'); + } /** From 6f54a4f37820eb6d470c0b75b8da0f3ff8def224 Mon Sep 17 00:00:00 2001 From: Knight Tan Date: Tue, 9 Jun 2015 00:20:20 +0800 Subject: [PATCH 2/3] Laravel 5 way to load the config --- src/Artistan/Nexmo/NexmoServiceProvider.php | 2 +- src/Artistan/Nexmo/Service/Account.php | 6 +++--- src/Artistan/Nexmo/Service/Message/Sms.php | 6 +++--- src/config/{auth.php => nexmo.php} | 4 +--- 4 files changed, 8 insertions(+), 10 deletions(-) rename src/config/{auth.php => nexmo.php} (70%) diff --git a/src/Artistan/Nexmo/NexmoServiceProvider.php b/src/Artistan/Nexmo/NexmoServiceProvider.php index 171f400..6b22d1b 100644 --- a/src/Artistan/Nexmo/NexmoServiceProvider.php +++ b/src/Artistan/Nexmo/NexmoServiceProvider.php @@ -21,7 +21,7 @@ class NexmoServiceProvider extends ServiceProvider { */ public function boot() { - + $this->publishes([__DIR__.'/../../config/nexmo.php' => config_path('nexmo.php')]); } /** diff --git a/src/Artistan/Nexmo/Service/Account.php b/src/Artistan/Nexmo/Service/Account.php index ea6a4b2..e7926e0 100644 --- a/src/Artistan/Nexmo/Service/Account.php +++ b/src/Artistan/Nexmo/Service/Account.php @@ -34,8 +34,8 @@ public function __construct ($api_key='', $api_secret='') { $this->nx_key = $api_key; $this->nx_secret = $api_secret; } else { - $this->nx_key = \Config::get('nexmo::auth.api_key'); - $this->nx_secret = \Config::get('nexmo::auth.api_secret'); + $this->nx_key = \Config::get('nexmo.api_key'); + $this->nx_secret = \Config::get('nexmo.api_secret'); } if(empty($this->nx_key) || empty($this->nx_secret)){ @@ -243,4 +243,4 @@ private function apiCall($command, $data=array()) { ); } -} \ No newline at end of file +} diff --git a/src/Artistan/Nexmo/Service/Message/Sms.php b/src/Artistan/Nexmo/Service/Message/Sms.php index 252f9a2..6f4eac9 100644 --- a/src/Artistan/Nexmo/Service/Message/Sms.php +++ b/src/Artistan/Nexmo/Service/Message/Sms.php @@ -49,8 +49,8 @@ public function __construct ($api_key='', $api_secret='') { $this->nx_key = $api_key; $this->nx_secret = $api_secret; } else { - $this->nx_key = \Config::get('nexmo::auth.api_key'); - $this->nx_secret = \Config::get('nexmo::auth.api_secret'); + $this->nx_key = \Config::get('nexmo.api_key'); + $this->nx_secret = \Config::get('nexmo.api_secret'); } if(empty($this->nx_key) || empty($this->nx_secret)){ @@ -398,4 +398,4 @@ public function reply ($message) { return $this->sendText($this->from, $this->to, $message); } -} \ No newline at end of file +} diff --git a/src/config/auth.php b/src/config/nexmo.php similarity index 70% rename from src/config/auth.php rename to src/config/nexmo.php index 43a4e29..d0209f7 100644 --- a/src/config/auth.php +++ b/src/config/nexmo.php @@ -1,7 +1,5 @@ 'api_key', 'api_secret' => 'api_secret' From 6f219baae11bd710ba002adf6da0be22dc6b3949 Mon Sep 17 00:00:00 2001 From: Knight Tan Date: Tue, 9 Jun 2015 00:22:52 +0800 Subject: [PATCH 3/3] update the README file to reflect the changes --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1702ae3..1f428a9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Nexmo for Laravel 4 +Nexmo for Laravel 5 ============== Implements a service for Nexmo messaging based on @@ -21,6 +21,10 @@ Add a ServiceProvider to your providers array in `app/config/app.php`: ) +### Publish the Vendor Config + +php artisan vendor:publish --provider="Artistan\Nexmo\NexmoServiceProvider" + ### Usage - work in progress Sending SMS via the Nexmo SMS gateway.