Download the PHP package by-zer0/sms-assistant-php without Composer
On this page you can find all versions of the php package by-zer0/sms-assistant-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download by-zer0/sms-assistant-php
More information about by-zer0/sms-assistant-php
Files in by-zer0/sms-assistant-php
Package sms-assistant-php
Short Description PHP library for using sms-assistent.by HTTP API
License MIT
Homepage https://github.com/ByZer0/sms-assistant-php
Informations about the package sms-assistant-php
sms-assistent.by API PHP wrapper
This library can be used to send messages via sms-assistent.by site.
More info about API can be found here.
Installation
Add following requirement to your composer.json file:
or just use composer command
Usage
First create client instance.
Constructor accepts ByZer0\SmsAssistantBy\Http\ClientInterface instance. This instance will be actually used to perform HTTP requests. By default, package contains ByZer0\SmsAssistantBy\Http\GuzzleClient class - request wrapper for guzzlehttp/guzzle library. You can write your own implementation of ByZer0\SmsAssistantBy\Http\ClientInterface to use with any other library.
Execute following command if you want to use default guzzle adapter:
Massive sending
Use method sendMessages($messages, $default = [], $time = null) to send multiple messages at once.
in this case $default represents common settings for each message. Default message can contain next fields:
sender- to use one sender name for every messagetext- common text can be placed here to avoid duplicate in every message
Every message must contain one required field:
phone- phone number of message recipient.
In addition to phone, every default value can be overwritten in any message.
You can also use third parameter of sendMessages() to delay send. Third parameter $time accepts DateTime instance.
Single message
Use method sendMessage($phone, $text, $time = null, $sender = null) to send single message.
This method accepts up to four parameters:
phone- Phone number of message recipient.text- Message text.time-DateTimeinstance. Use to delay message delivery.sender- Sender name. If used, this name will override default value specified bysetSender()method.