PHP code example of litgroup / sms

1. Go to this page and download the library: Download litgroup/sms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

litgroup / sms example snippets


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) {
    // ...
}

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

$messageService = new MessageService($cascadeGateway);