diff --git a/CHANGELOG.md b/CHANGELOG.md index c1cb169..4f10f09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,13 +3,20 @@ Simple SMS ##Change Log -####3.0.1 +#### 3.1.1 +* Laravel 5.4 Fix +* Added US Cellular + +#### 3.1.0 +* Added Just Send Driver and Bug Fixes + +#### 3.0.1 * Fixed a bug where the config file was not being copied correctly. -####3.0.0 +#### 3.0.0 * Updated Readme -####3.0.0-Beta1 +#### 3.0.0-Beta1 * Added FlowRoute Driver. --Thanks [rasumo](https://github.com/rasumo) * Added Plivo Driver. --Thanks [rasumo](https://github.com/rasumo) * Config file now users env by default. --Thanks [rasumo](https://github.com/rasumo) @@ -22,16 +29,16 @@ Simple SMS * Moved to PSR-4 Autoloading. * PSR-2 Cleanup. -####2.1.2 +#### 2.1.2 * An `outgoing message` is now returned when a message is sent. --Thanks [marfurt](https://github.com/marfurt) * The E-Mail driver only sends emails in text format now. --Thanks [cozylife](https://github.com/cozylife) * Added a new Zenvia Driver. --Thanks [filipegar](https://github.com/filipegar) * Updated docs to point to simplesoftware.io -####2.1.1 +#### 2.1.1 * Updated Twilio dependency. -####2.1.0 +#### 2.1.0 * Fixed doc blocks --Thanks [Ellrion](https://github.com/Ellrion) * Created Driver Manager class to better manager drivers. --Thanks [Ellrion](https://github.com/Ellrion) * Added LabsMobile driver --Thanks [borislalov](https://github.com/borislalov) @@ -39,7 +46,7 @@ Simple SMS * Added ability to switch drivers at runtime. * Fixed a bug when the `queue` method is called upon. -####2.0.0 +#### 2.0.0 * Full Laravel 5.X support. * Updated to Guzzle 6. * Dropped support for PHP 5.4 @@ -49,22 +56,22 @@ Simple SMS ####2.0.0-Beta1 * Adds support for Laravel 5 -####1.1.0 +#### 1.1.0 * Added MMS support for Twilio. * Corrected some typos in the readme. -####1.0.0 +#### 1.0.0 * Removed unstable development warnings. * Basic doc cleanup. -####Beta 1 +#### Beta 1 * Dropping receive support for CallFire due to not being able to get a keyword to test. * Dropping support for Mozeo receive due to not being able to get an API link forwarding set up automatically. -####Alpha 3 +#### Alpha 3 * General comment and code clean up. -####Alpha 2 +#### Alpha 2 * Expanded documentation. * EZTexting now supports checking for messages. * CallFire now supports checking for messages. diff --git a/docs/en/README.md b/docs/en/README.md index 62d64a7..9b102dc 100644 --- a/docs/en/README.md +++ b/docs/en/README.md @@ -125,6 +125,7 @@ The following are currently supported by using the e-mail gateway driver. | USA | Virgin Mobile | virginmobile | Yes | Yes | | USA | T-Mobile | tmobile | Yes | Yes | | USA | Sprint | sprint | Yes | Yes | +| USA | US Cellular | uscellular | Yes | Yes | >You must know the wireless provider for the mobile phone to use this driver. @@ -284,7 +285,7 @@ This driver sends messages through the [JustSend](https://justsend.pl/) messagin 'api_key' => 'Your API Key.' ] ]; - + `from` can be one of the following: - `ECO` - cheapest type (about 0.03 PLN per SMS). SMS will be send from random short-code number. - One of: `INFO`, `INFORMACJA`, `KONKURS`, `NOWOSC`, `OFERTA`, `OKAZJA`, `PROMOCJA`, `SMS` - about 0.06 PLN per SMS. diff --git a/src/DriverManager.php b/src/DriverManager.php index 1323a26..606fcc4 100644 --- a/src/DriverManager.php +++ b/src/DriverManager.php @@ -4,19 +4,19 @@ use GuzzleHttp\Client; use Illuminate\Support\Manager; -use SimpleSoftwareIO\SMS\Drivers\CallFireSMS; -use SimpleSoftwareIO\SMS\Drivers\EmailSMS; -use SimpleSoftwareIO\SMS\Drivers\EZTextingSMS; -use SimpleSoftwareIO\SMS\Drivers\FlowrouteSMS; -use SimpleSoftwareIO\SMS\Drivers\JustSendSMS; -use SimpleSoftwareIO\SMS\Drivers\LabsMobileSMS; +use SimpleSoftwareIO\SMS\Drivers\SMS77; use SimpleSoftwareIO\SMS\Drivers\LogSMS; +use SimpleSoftwareIO\SMS\Drivers\EmailSMS; use SimpleSoftwareIO\SMS\Drivers\MozeoSMS; use SimpleSoftwareIO\SMS\Drivers\NexmoSMS; use SimpleSoftwareIO\SMS\Drivers\PlivoSMS; -use SimpleSoftwareIO\SMS\Drivers\SMS77; use SimpleSoftwareIO\SMS\Drivers\TwilioSMS; use SimpleSoftwareIO\SMS\Drivers\ZenviaSMS; +use SimpleSoftwareIO\SMS\Drivers\CallFireSMS; +use SimpleSoftwareIO\SMS\Drivers\JustSendSMS; +use SimpleSoftwareIO\SMS\Drivers\EZTextingSMS; +use SimpleSoftwareIO\SMS\Drivers\FlowrouteSMS; +use SimpleSoftwareIO\SMS\Drivers\LabsMobileSMS; class DriverManager extends Manager { diff --git a/src/Drivers/AbstractSMS.php b/src/Drivers/AbstractSMS.php index 5476eb6..2a70b28 100644 --- a/src/Drivers/AbstractSMS.php +++ b/src/Drivers/AbstractSMS.php @@ -7,7 +7,6 @@ abstract class AbstractSMS { - protected $debug; /** @@ -72,7 +71,7 @@ protected function makeMessage($rawMessage) abstract protected function processReceive($rawMessage); /** - * Defines if debug is enabled or disabled (SMS77) + * Defines if debug is enabled or disabled (SMS77). * * @param $debug */ @@ -80,6 +79,4 @@ public function setDebug($debug) { $this->debug = $debug; } - - } diff --git a/src/Drivers/EmailSMS.php b/src/Drivers/EmailSMS.php index 60b9927..f154f8d 100644 --- a/src/Drivers/EmailSMS.php +++ b/src/Drivers/EmailSMS.php @@ -116,13 +116,11 @@ protected function lookupGateway($carrier, $mms) case 'airfiremobile': throw new \InvalidArgumentException('Air Fire Mobile does not support Email Gateway MMS messages.'); - case 'alaskacommunicates': return 'msg.acsalaska.com'; case 'ameritech': throw new \InvalidArgumentException('Ameritech does not support Email Gateway MMS messages.'); - case 'assurancewireless': return 'vmobl.com'; @@ -131,7 +129,6 @@ protected function lookupGateway($carrier, $mms) case 'cleartalk': throw new \InvalidArgumentException('Clear Talk does not support Email Gateway MMS messages.'); - case 'cricket': return 'mms.mycricket.com '; @@ -140,7 +137,6 @@ protected function lookupGateway($carrier, $mms) case 'nextech': throw new \InvalidArgumentException('NexTech does not support Email Gateway MMS messages.'); - case 'projectfi': return 'msg.fi.google.com'; @@ -162,6 +158,9 @@ protected function lookupGateway($carrier, $mms) case 'sprint': return 'pm.sprint.com'; + case 'uscellular': + return 'mms.uscc.net'; + default: throw new \InvalidArgumentException('Carrier specified is not found.'); } @@ -218,6 +217,9 @@ protected function lookupGateway($carrier, $mms) case 'sprint': return 'messaging.sprintpcs.com'; + case 'uscellular': + return 'email.uscc.net'; + default: throw new \InvalidArgumentException('Carrier specified is not found.'); } diff --git a/src/Drivers/LabsMobileSMS.php b/src/Drivers/LabsMobileSMS.php index 425361e..fad84da 100644 --- a/src/Drivers/LabsMobileSMS.php +++ b/src/Drivers/LabsMobileSMS.php @@ -3,8 +3,8 @@ namespace SimpleSoftwareIO\SMS\Drivers; use GuzzleHttp\Client; -use SimpleSoftwareIO\SMS\DoesNotReceive; use SimpleSoftwareIO\SMS\MakesRequests; +use SimpleSoftwareIO\SMS\DoesNotReceive; use SimpleSoftwareIO\SMS\OutgoingMessage; class LabsMobileSMS extends AbstractSMS implements DriverInterface diff --git a/src/Drivers/MozeoSMS.php b/src/Drivers/MozeoSMS.php index 06b1e42..c390889 100644 --- a/src/Drivers/MozeoSMS.php +++ b/src/Drivers/MozeoSMS.php @@ -3,8 +3,8 @@ namespace SimpleSoftwareIO\SMS\Drivers; use GuzzleHttp\Client; -use SimpleSoftwareIO\SMS\DoesNotReceive; use SimpleSoftwareIO\SMS\MakesRequests; +use SimpleSoftwareIO\SMS\DoesNotReceive; use SimpleSoftwareIO\SMS\OutgoingMessage; class MozeoSMS extends AbstractSMS implements DriverInterface diff --git a/src/Drivers/PlivoSMS.php b/src/Drivers/PlivoSMS.php index 3a9dc9f..d397663 100644 --- a/src/Drivers/PlivoSMS.php +++ b/src/Drivers/PlivoSMS.php @@ -148,7 +148,7 @@ protected function validateRequest() $signature = $_SERVER['X-Plivo-Signature']; $authToken = $this->authToken; - if (!$this->plivo->validate_signature($url, $data, $signature, $authToken)) { + if (! $this->plivo->validate_signature($url, $data, $signature, $authToken)) { throw new \InvalidArgumentException('This request was not able to verify it came from Plivo.'); } diff --git a/src/Drivers/SMS77.php b/src/Drivers/SMS77.php index 9c78d24..b7a65e8 100644 --- a/src/Drivers/SMS77.php +++ b/src/Drivers/SMS77.php @@ -1,9 +1,10 @@ hasError($responseBody)) { $this->handleError($responseBody); } + return $response; } /** - * Checks if the transaction has an error + * Checks if the transaction has an error. * * @param $body * @return bool @@ -81,20 +83,21 @@ protected function hasError($body) if ($body != '100') { return $body; } + return false; } /** - * Log the error message which ocurred + * Log the error message which ocurred. * * @param $body */ protected function handleError($body) { - $error = 'An error occurred. Status code: ' . $body . ' - '; + $error = 'An error occurred. Status code: '.$body.' - '; //From https://www.sms77.de/api.pdf Rückgabewerte (German doc) - switch($body){ + switch ($body) { case '101': $error .= 'Versand an mindestens einen Empfänger fehlgeschlagen'; break; diff --git a/src/Drivers/ZenviaSMS.php b/src/Drivers/ZenviaSMS.php index 290d23b..852b2e3 100644 --- a/src/Drivers/ZenviaSMS.php +++ b/src/Drivers/ZenviaSMS.php @@ -9,7 +9,7 @@ class ZenviaSMS extends AbstractSMS implements DriverInterface { use MakesRequests; - + /** * The API's URL. * @@ -119,7 +119,7 @@ public function checkMessages(array $options = []) $jsonResponse = json_decode($this->postRequest()->getBody()->getContents()); - if (!isset($jsonResponse->receivedResponse)) { + if (! isset($jsonResponse->receivedResponse)) { throw new \Exception('Invalid response from API. Missing mandatory object.'); } @@ -244,7 +244,7 @@ private function generateMessageBody($from, $number, $composeMessage) 'callbackOption' => $this->callbackOption, ]; - if (!is_null($number['carrier'])) { + if (! is_null($number['carrier'])) { $aux['id'] = $number['carrier']; } diff --git a/src/MakesRequests.php b/src/MakesRequests.php index 569afa8..62b9ffa 100644 --- a/src/MakesRequests.php +++ b/src/MakesRequests.php @@ -32,7 +32,7 @@ trait MakesRequests */ protected function buildCall($url) { - if (!$this->callBuilt) { + if (! $this->callBuilt) { $this->apiBase .= $url; $this->callBuilt = true; } diff --git a/src/SMS.php b/src/SMS.php index 7b497ba..5d607db 100644 --- a/src/SMS.php +++ b/src/SMS.php @@ -3,11 +3,11 @@ namespace SimpleSoftwareIO\SMS; use Closure; -use Illuminate\Container\Container; -use Illuminate\Queue\QueueManager; use Illuminate\Support\Str; -use SimpleSoftwareIO\SMS\Drivers\DriverInterface; use SuperClosure\Serializer; +use Illuminate\Queue\QueueManager; +use Illuminate\Container\Container; +use SimpleSoftwareIO\SMS\Drivers\DriverInterface; class SMS { @@ -191,7 +191,7 @@ public function laterOn($queue, $delay, $view, $data, $callback) */ protected function buildQueueCallable($callback) { - if (!$callback instanceof Closure) { + if (! $callback instanceof Closure) { return $callback; } diff --git a/src/SMSServiceProvider.php b/src/SMSServiceProvider.php index 5023bf9..ea9368f 100644 --- a/src/SMSServiceProvider.php +++ b/src/SMSServiceProvider.php @@ -47,7 +47,7 @@ public function register() */ public function registerSender() { - $this->app['sms.sender'] = $this->app->share(function ($app) { + $this->app->singleton('sms.sender', function ($app) { return (new DriverManager($app))->driver(); }); } diff --git a/tests/SMS77Test.php b/tests/SMS77Test.php index 01a74e7..0f89444 100644 --- a/tests/SMS77Test.php +++ b/tests/SMS77Test.php @@ -1,27 +1,21 @@ markTestSkipped('SMS77 integration Testing not possible with out SMS77 user name (SMS77USER + SMS77PASSWORD in ENV). Skipping.'); } $password = getenv('SMS77PASSWORD'); @@ -44,10 +38,8 @@ public function testSendSMS() $this->driver->send($message); } - - public function testSendSMSReal() { $this->markTestSkipped('Not sending real SMS - comment this line to try'); } -} \ No newline at end of file +}