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

This package is auto-updated.

Last update: 2024-01-30 23:06:51 UTC


README

GitHub Issues

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().