Skip to content
This repository has been archived by the owner on Jan 18, 2018. It is now read-only.
/ sms.php Public archive

🚫 (This project is no longer maintained.) Short messaging library for PHP

License

Notifications You must be signed in to change notification settings

LitGroupArchive/sms.php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMS

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

About

🚫 (This project is no longer maintained.) Short messaging library for PHP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages