2017 © Pedro Peláez
 

library skebby-rest-client

Unofficial Skebby Rest Client

image

fazland/skebby-rest-client

Unofficial Skebby Rest Client

  • Friday, April 6, 2018
  • by alekitto
  • Repository
  • 3 Watchers
  • 4 Stars
  • 3,602 Installations
  • PHP
  • 2 Dependents
  • 1 Suggesters
  • 5 Forks
  • 0 Open issues
  • 5 Versions
  • 7 % Grown

The README.md

Skebby Rest Client

Test codecov, (*1)

Fazland's Skebby Rest Client is an unofficial PHP Rest Client for the italian SMS GatewayProvider Skebby., (*2)

Requirements

  • php >= 7.4
  • php xml extension
  • symfony/options-resolver
  • giggsey/libphonenumber-for-php >= 8.0

Installation

The suggested installation method is via composer:, (*3)

$ composer require fazland/skebby-rest-client

Using Skebby Rest Client

It's really simple. First of all, configuration!, (*4)

Configuration

The mandatory configuration parameters are: - username - password - sender - method, (*5)

Just create a Client object passing to the constructor the parameters as an array:, (*6)

$this->skebbyRestClient = new Client([
    'username' => 'your_username',
    'password' => 'your_password',
    'sender' => '+393333333333',
    'method' => SendMethods::CLASSIC,
    'encoding_scheme' => EncodingSchemas::NORMAL,  // Optional
    'charset' => Charsets::UTF8,                   // Optional
    'endpoint_uri' => 'https://gateway.skebby.it/api/send/smseasy/advanced/rest.php' // (default)
]);

You can also set default values for delivery_start and validity_period, thus they can be overridden by the Sms object, (*7)

Creating SMS:

To create an SMS just follow the example:, (*8)

Sms::create()
    ->setRecipients([
        '+393473322444',
        '+393910000000'
    ])
    ->setRecipientVariables('+393473322444', [
        'name' => 'Mario',
        'quest' => 'Go and rescue Peach, Bowser kidnapped her!'
    ])
    ->setRecipientVariables('+393910000000', [
        'name' => 'Luigi',
        'quest' => 'Help Mario, Bowser is really bad!!'
    ])
    ->setText('Hey ${name}! ${quest}')
;

Send SMS!

Just use the Client::send(Sms $sms) method to send sms!, (*9)

$client->send($sms);

Note:

A single client will send SMS through the method you specified in configuration. If you want to send it through another method, just create a new client., (*10)

Events

You can leverage your preferred event system, as long as it implements PSR-14. Just pass your dispatcher as third argument of Client constructor:, (*11)

$dispatcher = new EventDispatcher();    // any dispatcher implementing EventDispatcherInterface
$options = [/* .. */];  // see above for detailed options
$this->skebbyRestClient = new Client($options, null, $dispatcher);

Each time an SMS is sent, a \Fazland\SkebbyRestClient\Event\SmsMessageEvent will be dispatched., (*12)

Test

Run, (*13)

$ vendor/bin/phpunit

Contributing

Contributions are welcome. Feel free to open a PR or file an issue here on GitHub!, (*14)

License

Skebby Rest Client is licensed under the MIT License - see the LICENSE file for details, (*15)

The Versions

26/10 2016

0.1.0

0.1.0.0

Unofficial Skebby Rest Client

  Sources   Download

MIT

The Requires

 

The Development Requires

by Massimiliano Braglia