Coder Social home page Coder Social logo

skebby-rest-client's Introduction

Skebby Rest Client

Build Status Scrutinizer Code Quality Code Coverage

Fazland's Skebby Rest Client is an unofficial PHP Rest Client for the italian SMS GatewayProvider Skebby.

Requirements

  • php >= 5.5.0
  • php curl extension
  • symfony/options-resolver >= 2.7
  • giggsey/libphonenumber-for-php 7.*

Installation

The suggested installation method is via composer:

$ composer require fazland/skebby-rest-client

Using Skebby Rest Client

It's really simple. First of all, configuration!

Configuration

The mandatory configuration parameters are:

  • username
  • password
  • sender
  • method

Just create a Client object passing to the constructor the parameters as an array:

$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

Creating SMS:

To create an SMS just follow the example:

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!

$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.

Contributing

Contributions are welcome. Feel free to open a PR or file an issue here on GitHub!

License

Skebby Rest Client is licensed under the MIT License - see the LICENSE file for details

skebby-rest-client's People

Contributors

alekitto avatar garak avatar massimilianobraglia avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.