Skip to content

Commit

Permalink
Merge pull request #56 from SimpleSoftwareIO/develop
Browse files Browse the repository at this point in the history
3.1.0
  • Loading branch information
SimplyCorey authored Feb 22, 2017
2 parents c98ac86 + ae14387 commit 1879b8a
Show file tree
Hide file tree
Showing 30 changed files with 587 additions and 127 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
language: php
sudo: false
php:
- 5.6
- 7.0
- hhvm
- 7.1

before_script:
- composer install --dev
Expand Down
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2014 Simple Software LLC www.simplesoftware.io
Copyright (c) 2014-2016 Simple Software LLC www.simplesoftware.io

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Simple SMS
[![Total Downloads](https://poser.pugx.org/simplesoftwareio/simple-sms/downloads.svg)](https://packagist.org/packages/simplesoftwareio/simple-sms)

## Introduction
Simple SMS is an easy to use package for [Laravel](http://laravel.com/) that adds the capability to send and receive SMS/MMS messages to mobile phones from your web app. It currently supports a free way to send SMS messages through E-Mail gateways provided by the wireless carriers. The package also supports 9 paid services, [Call Fire,](https://www.callfire.com/) [EZTexting,](https://www.eztexting.com) [FlowRoute,](https://www.flowroute.com/) [LabsMobile,](http://www.labsmobile.com) [Mozeo,](https://www.mozeo.com/) [Nexmo,](https://www.nexmo.com/) [Plivo,](https://www.plivo.com/) [Twilio,](https://www.twilio.com) and [Zenvia.](http://www.zenvia.com.br/)
Simple SMS is an easy to use package for [Laravel](http://laravel.com/) that adds the capability to send and receive SMS/MMS messages to mobile phones from your web app. It currently supports a free way to send SMS messages through E-Mail gateways provided by the wireless carriers. The package also supports 9 paid services, [Call Fire,](https://www.callfire.com/) [EZTexting,](https://www.eztexting.com) [FlowRoute,](https://www.flowroute.com/) [LabsMobile,](http://www.labsmobile.com) [Mozeo,](https://www.mozeo.com/) [Nexmo,](https://www.nexmo.com/) [Plivo,](https://www.plivo.com/) [Twilio,](https://www.twilio.com) [Zenvia,](http://www.zenvia.com.br/) and [JustSend.](http://www.justsend.pl/)

## Official Documentation

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}
],
"require": {
"php": ">=5.5.0",
"php": ">=7.0.0",
"illuminate/mail": ">=5.0.0",
"illuminate/log": ">=5.0.0",
"illuminate/queue": ">=5.0.0",
Expand Down
21 changes: 21 additions & 0 deletions docs/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Simple SMS is an easy to use package for [Laravel](http://laravel.com/) that add
* [Plivo Driver](#docs-plivo-driver)
* [Twilio Driver](#docs-twilio-driver)
* [Zenvia Driver](#docs-zenvia-driver)
* [JustSend Driver](#docs-justsend-driver)
* [Driver Support](#docs-driver-support)
* [Usage](#docs-usage)
* [Outgoing Message Enclosure](#docs-outgoing-enclosure)
Expand Down Expand Up @@ -123,6 +124,7 @@ The following are currently supported by using the e-mail gateway driver.
| USA | Verizon Wireless | verizonwireless | Yes | Yes |
| USA | Virgin Mobile | virginmobile | Yes | Yes |
| USA | T-Mobile | tmobile | Yes | Yes |
| USA | Sprint | sprint | Yes | Yes |

>You must know the wireless provider for the mobile phone to use this driver.
Expand Down Expand Up @@ -270,6 +272,24 @@ This driver sends messages through the [Zenvia](http://www.zenvia.com.br/ messag
]
];

<a id="docs-justsend-driver"></a>
###### JustSend Driver

This driver sends messages through the [JustSend](https://justsend.pl/) messaging service which is only avaliable in Poland.

return [
'driver' => 'justsend',
'from' => 'From text',
'justsend' => [
'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.
- Any other text (can not be only number) - about 0.07 PLN per SMS.

<a id="docs-infobip-driver"></a>

<a id="docs-driver-support"></a>
Expand All @@ -290,6 +310,7 @@ Not all drivers support every method due to the differences in each individual A
| Plivo | Yes | Yes | Yes | Yes | Yes |
| Twilio | Yes | Yes | Yes | Yes | Yes |
| Zenvia | Yes | Yes | Yes | Yes | Yes |
| JustSend | Yes | Yes | No | No | No |

<a id="docs-usage"></a>
## Usage
Expand Down
2 changes: 1 addition & 1 deletion src/DoesNotReceive.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SimpleSoftwareIO\SMS;

trait DoesNotReceive
Expand All @@ -21,7 +22,6 @@ public function checkMessages(array $options = [])
* @param string|int $messageId
*
* @throws \RuntimeException
*
*/
public function getMessage($messageId)
{
Expand Down
70 changes: 54 additions & 16 deletions src/DriverManager.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
<?php

namespace SimpleSoftwareIO\SMS;

use GuzzleHttp\Client;
use Illuminate\Support\Manager;
use SimpleSoftwareIO\SMS\Drivers\LogSMS;
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\LogSMS;
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\EZTextingSMS;
use SimpleSoftwareIO\SMS\Drivers\FlowrouteSMS;
use SimpleSoftwareIO\SMS\Drivers\LabsMobileSMS;

class DriverManager extends Manager
{
Expand Down Expand Up @@ -59,7 +62,7 @@ protected function createCallfireDriver()
$config = $this->app['config']->get('sms.callfire', []);

$provider = new CallFireSMS(
new Client,
new Client(),
$config['app_login'],
$config['app_password']
);
Expand Down Expand Up @@ -91,7 +94,7 @@ protected function createEztextingDriver()
$provider = new EZTextingSMS(new Client());

$data = [
'User' => $config['username'],
'User' => $config['username'],
'Password' => $config['password'],
];

Expand Down Expand Up @@ -134,8 +137,8 @@ protected function createMozeoDriver()

$auth = [
'companykey' => $config['company_key'],
'username' => $config['username'],
'password' => $config['password'],
'username' => $config['username'],
'password' => $config['password'],
];
$provider->buildBody($auth);

Expand Down Expand Up @@ -177,11 +180,11 @@ protected function createTwilioDriver()
);
}

/**
* Create an instance of the Zenvia driver.
*
* @return ZenviaSMS
*/
/**
* Create an instance of the Zenvia driver.
*
* @return ZenviaSMS
*/
protected function createZenviaDriver()
{
$config = $this->app['config']->get('sms.zenvia', []);
Expand Down Expand Up @@ -214,7 +217,7 @@ protected function createPlivoDriver()
}

/**
* Create an instance of the flowroute driver
* Create an instance of the flowroute driver.
*
* @return FlowrouteSMS
*/
Expand All @@ -223,11 +226,46 @@ protected function createFlowrouteDriver()
$config = $this->app['config']->get('sms.flowroute', []);

$provider = new FlowrouteSMS(
new Client,
new Client(),
$config['access_key'],
$config['secret_key']
);

return $provider;
}

/**
* Create an instance of the SMS77 driver.
*
* @return SMS77
*/
protected function createSms77Driver()
{
$config = $this->app['config']->get('sms.sms77', []);

$provider = new SMS77(
new Client(),
$config['user'],
$config['api_key'],
$config['debug']
);

return $provider;
}

/**
* Create an instance of the justsend driver.
*
* @return JustSendSMS
*/
protected function createJustSendDriver()
{
$config = $this->app['config']->get('sms.justsend', []);

$provider = new JustSendSMS(
$config['api_key']
);

return $provider;
}
}
23 changes: 20 additions & 3 deletions src/Drivers/AbstractSMS.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
<?php

namespace SimpleSoftwareIO\SMS\Drivers;

use SimpleSoftwareIO\SMS\IncomingMessage;
use SimpleSoftwareIO\SMS\SMSNotSentException;

abstract class AbstractSMS
{

protected $debug;

/**
* Throw a not sent exception
* Throw a not sent exception.
*
* @param string $message
* @param null|int $code
*
* @param string $message
* @param null|integer $code
* @throws SMSNotSentException
*/
protected function throwNotSentException($message, $code = null)
Expand Down Expand Up @@ -65,4 +70,16 @@ protected function makeMessage($rawMessage)
* @return mixed
*/
abstract protected function processReceive($rawMessage);

/**
* Defines if debug is enabled or disabled (SMS77)
*
* @param $debug
*/
public function setDebug($debug)
{
$this->debug = $debug;
}


}
7 changes: 4 additions & 3 deletions src/Drivers/CallFireSMS.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SimpleSoftwareIO\SMS\Drivers;

use GuzzleHttp\Client;
Expand Down Expand Up @@ -48,7 +49,7 @@ public function send(OutgoingMessage $message)
$numbers = implode(',', $message->getTo());

$data = [
'To' => $numbers,
'To' => $numbers,
'Message' => $composeMessage,
];

Expand Down Expand Up @@ -112,9 +113,9 @@ public function getMessage($messageId)
*
* @param mixed $raw
*
* @return \SimpleSoftwareIO\SMS\IncomingMessage
*
* @throws \RuntimeException
*
* @return \SimpleSoftwareIO\SMS\IncomingMessage
*/
public function receive($raw)
{
Expand Down
1 change: 1 addition & 0 deletions src/Drivers/DriverInterface.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SimpleSoftwareIO\SMS\Drivers;

use SimpleSoftwareIO\SMS\OutgoingMessage;
Expand Down
3 changes: 2 additions & 1 deletion src/Drivers/EZTextingSMS.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SimpleSoftwareIO\SMS\Drivers;

use GuzzleHttp\Client;
Expand Down Expand Up @@ -51,7 +52,7 @@ public function send(OutgoingMessage $message)

$data = [
'PhoneNumbers' => $message->getTo(),
'Message' => $composedMessage,
'Message' => $composedMessage,
];

$this->buildCall('/sending/messages');
Expand Down
15 changes: 11 additions & 4 deletions src/Drivers/EmailSMS.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace SimpleSoftwareIO\SMS\Drivers;

use Illuminate\Mail\Mailer;
Expand Down Expand Up @@ -43,7 +44,7 @@ public function send(OutgoingMessage $message)
/**
* Generates the Laravel Message Object.
*
* @param Illuminate\Mail\Message $email
* @param Illuminate\Mail\Message $email
* @param SimpleSoftwareIO\SMS\OutgoingMessage $message
*
* @return Illuminate\Mail\Message
Expand Down Expand Up @@ -84,14 +85,14 @@ protected function sendRaw(OutgoingMessage $message)
/**
* Builds the email address of a number.
*
* @param array $number
* @param array $number
* @param SimpleSoftwareIO\SMS\OutgoingMessage $message
*
* @return string
*/
protected function buildEmail($number, OutgoingMessage $message)
{
if ( ! $number['carrier']) {
if (! $number['carrier']) {
throw new \InvalidArgumentException('A carrier must be specified if using the E-Mail Driver.');
}

Expand All @@ -102,7 +103,7 @@ protected function buildEmail($number, OutgoingMessage $message)
* Finds the gateway based on the carrier and MMS.
*
* @param string $carrier
* @param boolean $mms
* @param bool $mms
*
* @return string
*/
Expand Down Expand Up @@ -158,6 +159,9 @@ protected function lookupGateway($carrier, $mms)
case 'tmobile':
return 'tmomail.net';

case 'sprint':
return 'pm.sprint.com';

default:
throw new \InvalidArgumentException('Carrier specified is not found.');
}
Expand Down Expand Up @@ -211,6 +215,9 @@ protected function lookupGateway($carrier, $mms)
case 'tmobile':
return 'tmomail.net';

case 'sprint':
return 'messaging.sprintpcs.com';

default:
throw new \InvalidArgumentException('Carrier specified is not found.');
}
Expand Down
Loading

0 comments on commit 1879b8a

Please sign in to comment.