wearesho-team/message-delivery implementation of Delivery\ServiceInterface
composer require wearsho-team/turbosms-message-delivery:^3.0- Install to your Project
composer require wearsho-team/turbosms-message-delivery:^3.0- Configure environment
| Variable | Required | Description |
|---|---|---|
| TURBOSMS_HTTP_TOKEN | Yes | HTTP API Token |
| TURBOSMS_SENDER | no | Sender name, that was declared in your account |
- 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",
]);ConfigInterface have to be used to configure requests. Available implementations:
- Config - simple implementation using class properties
- EnvironmentConfig - loads configuration values from environment using getenv
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"
