This package is abandoned and no longer maintained. No replacement package was suggested.

Provider neutral SMS library.

v0.6.0 2016-06-14 14:08 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:53:38 UTC


README

🚫 This project is no longer maintained.

Provider neutral SMS library for PHP 5.5+

Version Dev Version License Downloads Build Status

Read the documentation for the last release here.

Installation

composer require litgroup/sms=0.6.*

Example of usage

Message sending

use LitGroup\Sms\Message;
use LitGroup\Sms\MessageService;
use LitGroup\Sms\Exception\SmsException;

// Some implementation of `LitGroup\Sms\Gateway\GatewayInterface`
$gateway = new SomeGateway();

// Create Short Message Service
$messageService = new MessageService($gateway);

// Create and send some message.
try {
    $messageService->sendMessage(
        'Hello, customer!',
        ['+79991234567'],
        'AcmeCompany'
    );
} catch (SmsException $e) {
    // ...
}

Use cascade of gateways

It's possible to use cascade of gateways of several providers to improve fault-tolerance. Use LitGroup\Sms\Gateway\CascadeGateway.

$cascadeGateway = new CascadeGateway([
    new AGateway(),
    new BGateway(),
]);

$messageService = new MessageService($cascadeGateway);

Logging of exceptions

  • Constructor of MessageService receives Psr\Log\LoggerInterface.
  • If you use CascadeGateway then inject a logger into the instance of CascadeGateway too. Warnings will be logged if some of gateways are inoperative.