alexeevdv/php-sms-smsru

0.1.0 2020-06-01 12:16 UTC

This package is auto-updated.

Last update: 2021-12-29 02:54:19 UTC


README

Build Status codecov PHP 7.1 PHP 7.2 PHP 7.3 PHP 7.4

PHP package for sending SMS messages via sms.ru provider

Usage

use alexeevdv\Sms\SmsRu\Exception\Exception as SmsRuException;
use alexeevdv\Sms\SmsRu\PhoneNumber;
use alexeevdv\Sms\SmsRu\Provider;

$httpClient = new Psr18CompatibleHttpClient();
$requestFactory = new Psr17CompatibleRequestFactory();

$provider = new Provider('Your API key', $httpClient, $requestFactory);
try {
   $messageId = $provider->sendMessage(new PhoneNumber('+1-234-567-89-10'), 'Hello!');
} catch (SmsRuException $e) {
   // Message is not sent
}