From 0f701a258a47c8c481ac44e85a4bfeac0de7b72b Mon Sep 17 00:00:00 2001 From: dpslwk Date: Tue, 21 May 2019 05:51:19 +0100 Subject: [PATCH] Nexmo: pull in sms dependancy --- app/HMS/Entities/User.php | 12 ++ composer.json | 1 + composer.lock | 334 ++++++++++++++++++++++++++++++++++---- config/services.php | 6 + 4 files changed, 320 insertions(+), 33 deletions(-) diff --git a/app/HMS/Entities/User.php b/app/HMS/Entities/User.php index dd2c4e32f..0d93cb4f1 100644 --- a/app/HMS/Entities/User.php +++ b/app/HMS/Entities/User.php @@ -444,4 +444,16 @@ public function setGoogle2faSecret($google2faSecret) return $this; } + + /** + * Route notifications for the Nexmo channel. + * + * @param \Illuminate\Notifications\Notification $notification + * + * @return string + */ + public function routeNotificationForNexmo($notification) + { + return $this->profile->getContactNumber(); + } } diff --git a/composer.json b/composer.json index be43f0dd6..12d24c27f 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,7 @@ "laravel-doctrine/orm": "1.4.*", "laravel/framework": "5.8.*", "laravel/horizon": "^3.1", + "laravel/nexmo-notification-channel": "^2.0", "laravel/passport": "^7.0", "laravel/slack-notification-channel": "^2.0", "laravel/tinker": "^1.0", diff --git a/composer.lock b/composer.lock index 6a9ed8673..defaae45f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1c1675b460761dcafe4652e6abbd23d7", + "content-hash": "ab38f122ef5f9d7851ec8b4de76fcb65", "packages": [ { "name": "bacon/bacon-qr-code", @@ -1331,16 +1331,16 @@ }, { "name": "egulias/email-validator", - "version": "2.1.7", + "version": "2.1.8", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e" + "reference": "c26463ff9241f27907112fbcd0c86fa670cfef98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/709f21f92707308cdf8f9bcfa1af4cb26586521e", - "reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/c26463ff9241f27907112fbcd0c86fa670cfef98", + "reference": "c26463ff9241f27907112fbcd0c86fa670cfef98", "shasum": "" }, "require": { @@ -1384,7 +1384,7 @@ "validation", "validator" ], - "time": "2018-12-04T22:38:24+00:00" + "time": "2019-05-16T22:02:54+00:00" }, { "name": "erusev/parsedown", @@ -2285,16 +2285,16 @@ }, { "name": "laravel/framework", - "version": "v5.8.17", + "version": "v5.8.18", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "33c04dd2a431adeeb49926a4f2b20590cc033ca2" + "reference": "9f571be04435883dab6f23ecfadb204273b7f527" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/33c04dd2a431adeeb49926a4f2b20590cc033ca2", - "reference": "33c04dd2a431adeeb49926a4f2b20590cc033ca2", + "url": "https://api.github.com/repos/laravel/framework/zipball/9f571be04435883dab6f23ecfadb204273b7f527", + "reference": "9f571be04435883dab6f23ecfadb204273b7f527", "shasum": "" }, "require": { @@ -2428,20 +2428,20 @@ "framework", "laravel" ], - "time": "2019-05-14T16:02:41+00:00" + "time": "2019-05-21T16:40:34+00:00" }, { "name": "laravel/horizon", - "version": "v3.1.2", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/laravel/horizon.git", - "reference": "32313d787a7a7575c1866e8ed12ec944c1513b7f" + "reference": "a9204280f72a1c6d3874e0f98b68e354b212311a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/horizon/zipball/32313d787a7a7575c1866e8ed12ec944c1513b7f", - "reference": "32313d787a7a7575c1866e8ed12ec944c1513b7f", + "url": "https://api.github.com/repos/laravel/horizon/zipball/a9204280f72a1c6d3874e0f98b68e354b212311a", + "reference": "a9204280f72a1c6d3874e0f98b68e354b212311a", "shasum": "" }, "require": { @@ -2497,7 +2497,64 @@ "laravel", "queue" ], - "time": "2019-04-30T15:20:11+00:00" + "time": "2019-05-21T19:58:03+00:00" + }, + { + "name": "laravel/nexmo-notification-channel", + "version": "v2.0.0", + "source": { + "type": "git", + "url": "https://github.com/laravel/nexmo-notification-channel.git", + "reference": "eaa29b552307c4866bfc40f33f440ee78a9ac9ec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/nexmo-notification-channel/zipball/eaa29b552307c4866bfc40f33f440ee78a9ac9ec", + "reference": "eaa29b552307c4866bfc40f33f440ee78a9ac9ec", + "shasum": "" + }, + "require": { + "illuminate/notifications": "~5.8.0", + "nexmo/client": "^1.0", + "php": "^7.1.3" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + }, + "laravel": { + "providers": [ + "Illuminate\\Notifications\\NexmoChannelServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Illuminate\\Notifications\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Nexmo Notification Channel for laravel.", + "keywords": [ + "laravel", + "nexmo", + "notifications" + ], + "time": "2019-02-26T16:11:35+00:00" }, { "name": "laravel/passport", @@ -2691,33 +2748,30 @@ }, { "name": "lcobucci/jwt", - "version": "3.2.5", + "version": "3.3.1", "source": { "type": "git", "url": "https://github.com/lcobucci/jwt.git", - "reference": "82be04b4753f8b7693b62852b7eab30f97524f9b" + "reference": "a11ec5f4b4d75d1fcd04e133dede4c317aac9e18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/lcobucci/jwt/zipball/82be04b4753f8b7693b62852b7eab30f97524f9b", - "reference": "82be04b4753f8b7693b62852b7eab30f97524f9b", + "url": "https://api.github.com/repos/lcobucci/jwt/zipball/a11ec5f4b4d75d1fcd04e133dede4c317aac9e18", + "reference": "a11ec5f4b4d75d1fcd04e133dede4c317aac9e18", "shasum": "" }, "require": { + "ext-mbstring": "*", "ext-openssl": "*", - "php": ">=5.5" + "php": "^5.6 || ^7.0" }, "require-dev": { - "mdanter/ecc": "~0.3.1", "mikey179/vfsstream": "~1.5", "phpmd/phpmd": "~2.2", "phpunit/php-invoker": "~1.1", - "phpunit/phpunit": "~4.5", + "phpunit/phpunit": "^5.7 || ^7.3", "squizlabs/php_codesniffer": "~2.3" }, - "suggest": { - "mdanter/ecc": "Required to use Elliptic Curves based algorithms." - }, "type": "library", "extra": { "branch-alias": { @@ -2737,7 +2791,7 @@ { "name": "Luís Otávio Cobucci Oblonczyk", "email": "lcobucci@gmail.com", - "role": "developer" + "role": "Developer" } ], "description": "A simple library to work with JSON Web Token and JSON Web Signature", @@ -2745,7 +2799,7 @@ "JWS", "jwt" ], - "time": "2018-11-11T12:22:26+00:00" + "time": "2019-05-24T18:30:49+00:00" }, { "name": "league/event", @@ -2799,16 +2853,16 @@ }, { "name": "league/flysystem", - "version": "1.0.51", + "version": "1.0.52", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "755ba7bf3fb9031e6581d091db84d78275874396" + "reference": "c5a5097156387970e6f0ccfcdf03f752856f3391" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/755ba7bf3fb9031e6581d091db84d78275874396", - "reference": "755ba7bf3fb9031e6581d091db84d78275874396", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/c5a5097156387970e6f0ccfcdf03f752856f3391", + "reference": "c5a5097156387970e6f0ccfcdf03f752856f3391", "shasum": "" }, "require": { @@ -2879,7 +2933,7 @@ "sftp", "storage" ], - "time": "2019-03-30T13:22:34+00:00" + "time": "2019-05-20T20:21:14+00:00" }, { "name": "league/oauth2-server", @@ -3195,6 +3249,54 @@ ], "time": "2019-04-19T10:27:42+00:00" }, + { + "name": "nexmo/client", + "version": "1.8.1", + "source": { + "type": "git", + "url": "https://github.com/Nexmo/nexmo-php.git", + "reference": "182d41a02ebd3e4be147baea45458ccfe2f528c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Nexmo/nexmo-php/zipball/182d41a02ebd3e4be147baea45458ccfe2f528c4", + "reference": "182d41a02ebd3e4be147baea45458ccfe2f528c4", + "shasum": "" + }, + "require": { + "lcobucci/jwt": "^3.2", + "php": ">=5.6", + "php-http/client-implementation": "^1.0", + "php-http/guzzle6-adapter": "^1.0", + "zendframework/zend-diactoros": "^1.8.4 || ^2.0" + }, + "require-dev": { + "estahn/phpunit-json-assertions": "^1.0.0", + "php-http/mock-client": "^0.3.0", + "phpunit/phpunit": "^5.7", + "squizlabs/php_codesniffer": "^3.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "Nexmo\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tim Lytle", + "email": "tim@nexmo.com", + "homepage": "http://twitter.com/tjlytle", + "role": "Developer" + } + ], + "description": "PHP Client for using Nexmo's API.", + "time": "2019-05-13T20:27:43+00:00" + }, { "name": "nikic/php-parser", "version": "v4.2.1", @@ -3626,6 +3728,172 @@ ], "time": "2019-01-19T15:11:35+00:00" }, + { + "name": "php-http/guzzle6-adapter", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/php-http/guzzle6-adapter.git", + "reference": "a56941f9dc6110409cfcddc91546ee97039277ab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/guzzle6-adapter/zipball/a56941f9dc6110409cfcddc91546ee97039277ab", + "reference": "a56941f9dc6110409cfcddc91546ee97039277ab", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0", + "php": ">=5.5.0", + "php-http/httplug": "^1.0" + }, + "provide": { + "php-http/async-client-implementation": "1.0", + "php-http/client-implementation": "1.0" + }, + "require-dev": { + "ext-curl": "*", + "php-http/adapter-integration-tests": "^0.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Adapter\\Guzzle6\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + }, + { + "name": "David de Boer", + "email": "david@ddeboer.nl" + } + ], + "description": "Guzzle 6 HTTP Adapter", + "homepage": "http://httplug.io", + "keywords": [ + "Guzzle", + "http" + ], + "time": "2016-05-10T06:13:32+00:00" + }, + { + "name": "php-http/httplug", + "version": "v1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/httplug.git", + "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/httplug/zipball/1c6381726c18579c4ca2ef1ec1498fdae8bdf018", + "reference": "1c6381726c18579c4ca2ef1ec1498fdae8bdf018", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "php-http/promise": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "henrikbjorn/phpspec-code-coverage": "^1.0", + "phpspec/phpspec": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eric GELOEN", + "email": "geloen.eric@gmail.com" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "HTTPlug, the HTTP client abstraction for PHP", + "homepage": "http://httplug.io", + "keywords": [ + "client", + "http" + ], + "time": "2016-08-31T08:30:17+00:00" + }, + { + "name": "php-http/promise", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/promise.git", + "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/promise/zipball/dc494cdc9d7160b9a09bd5573272195242ce7980", + "reference": "dc494cdc9d7160b9a09bd5573272195242ce7980", + "shasum": "" + }, + "require-dev": { + "henrikbjorn/phpspec-code-coverage": "^1.0", + "phpspec/phpspec": "^2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "Http\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + }, + { + "name": "Joel Wurtz", + "email": "joel.wurtz@gmail.com" + } + ], + "description": "Promise used for asynchronous HTTP requests", + "homepage": "http://httplug.io", + "keywords": [ + "promise" + ], + "time": "2016-01-26T13:27:02+00:00" + }, { "name": "phpoption/phpoption", "version": "1.5.0", diff --git a/config/services.php b/config/services.php index f026b2c70..97fdc6ec9 100644 --- a/config/services.php +++ b/config/services.php @@ -44,4 +44,10 @@ ], ], + 'nexmo' => [ + 'key' => env('NEXMO_KEY'), + 'secret' => env('NEXMO_SECRET'), + 'sms_from' => env('NEXMO_FROM', '15556666666'), + ], + ];