wearesho-team/turbosms-message-delivery

Turbosms message delivery integration

3.0.1 2025-02-19 20:49 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:^3.0

Quick Start

  • Install to your Project
composer require wearsho-team/turbosms-message-delivery:^3.0
  • Configure environment
  • Use in your code
<?php
use Wearesho\Delivery\Message;
use Wearesho\Delivery\MessageOptionsInterface;
use Wearesho\Delivery\TurboSms;
$service = TurboSms\Service::instance();
$service->auth();
$service->balance();
$service->send(new Message("Text", "3809700000000"));
$service->batch("Text", ["3809700000000", "3809700000001"]);
$service->batch("Text", "3809700000001", [
    MessageOptionsInterface::OPTION_SENDER_NAME => "customSenderName",
]);

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('httpToken', 'senderName (alpha name)'),
);
  • 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