tomas-kulhanek / sms-manager
This package is abandoned and no longer maintained.
No replacement package was suggested.
PHP library for sending SMS via SmsManager.cz
v1.0.1
2021-08-26 22:38 UTC
Requires
- php: >=7.2
- ext-dom: *
- ext-libxml: *
- ext-simplexml: *
- consistence-community/consistence: ^2.1
- nyholm/psr7: ^1.4
- psr/http-client: ^1.0
Requires (Dev)
- php-http/httplug: ^2.2
- phpstan/phpstan: ^0.12.96
- phpstan/phpstan-phpunit: ^0.12.22
- phpstan/phpstan-strict-rules: ^0.12.11
- phpunit/phpunit: ^9.5
- symfony/http-client: ^5.3
README
Library for PHP that can send SMS messages via SmsManager.cz gateway. (not all API methods are implemented for now)
Refactored from simPod/SMSManager
Installation
composer require tomas-kulhanek/sms-manager
Usage
Use SmsManager
interface in your code, eg.:
public function __construct(SmsManager $smsManager) { ... }
and alias SMSManager to ApiSmsManager
for your production usage.
Example with Symfony:
services: TomasKulhanek\SmsManager\SmsManager: alias: TomasKulhanek\SmsManager\ApiSmsManager
To send message, create new SmsMessage
:
$httpClient = new \Symfony\Component\HttpClient\HttplugClient(); // you can use any client for psr-7 $smsManager = new \TomasKulhanek\SmsManager\ApiSmsManager($httpClient); $smsMessage = new \TomasKulhanek\SmsManager\SmsMessage( 'message text', [ '+420777888999' ], \TomasKulhanek\SmsManager\RequestType::getRequestTypeLow(), // optional, defaults to High 'sender', // optional 1 // optional, CustomID ); $smsManager->send($smsMessage);
Third parameter of SmsMessage
is RequestType that is represented by RequestType
class. Eg. low request type is instantiated with RequestType::getRequestTypeLow()
.