wearesho-team/turbosms-message-delivery

Turbosms message delivery integration

1.0.5 2022-12-01 12:18 UTC

README

Test & Lint Latest Stable Version Total Downloads codecov

wearesho-team/message-delivery implementation of Delivery\ServiceInterface

Installation

composer require wearsho-team/turbosms-message-delivery:^1.0.3

Quick Start

  • Install to your Project
composer require wearsho-team/turbosms-message-delivery:^1.0.3
  • Configure environment
Variable Required Description
TURBOSMS_LOGIN Yes Your login to gateway
TURBOSMS_PASSWORD Yes Your password to gateway
TURBOSMS_SENDER no Sender name, that was declared in your account
  • Use in your code
<?php
use Wearesho\Delivery\Message;
use Wearesho\Delivery\TurboSms;
$service = TurboSms\Service::instance();
$service->auth();
$service->balance();
$service->send(new Message("Text", "3809700000000"));
$service->batch("Text", "3809700000000", "3809700000001"/** etc */);

Usage

Configuration

ConfigInterface have to be used to configure requests. Available implementations:

Additional methods

Besides implementing Delivery\ServiceInterface Service provides

<?php

use Wearesho\Delivery;

$service = new Delivery\TurboSms\Service(
    new Delivery\TurboSms\Config('login', 'password'),
    new GuzzleHttp\Client(['cookies' => true])
);
  • Send sms
<?php

use Wearesho\Delivery;

/** @var Delivery\TurboSms\Service $service */

$service->send(
    new Delivery\Message('Message', '+380000000000')
);
  • Check balance on current account
<?php

use Wearesho\Delivery;

/** @var Delivery\TurboSms\Service $service */

$balance = $service->balance();
$balance->getAmount();
$balance->getCurrency();

$message = (string)$balance; // will output "{amount} Credits"

Authors

License

MIT