alexeevdv / php-sms-smsru
0.1.0
2020-06-01 12:16 UTC
Requires
- alexeevdv/php-sms-contracts: ^0.2.0
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
Requires (Dev)
- codeception/codeception: ^4.1
- codeception/module-asserts: ^1.2
- guzzlehttp/psr7: ^1.6
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-10-29 06:05:50 UTC
README
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 }