wearesho-team / turbosms-message-delivery
Turbosms message delivery integration
1.0.5
2022-12-01 12:18 UTC
Requires
- php: ^7.4 | ^8.0
- guzzlehttp/guzzle: ^6.5.8 || ^7.4.5
- horat1us/environment-config: ^1.4
- wearesho-team/message-delivery: ^1.7.0
Requires (Dev)
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.7
- symfony/console: ^5.1
- symfony/dependency-injection: ^5.1
- vlucas/phpdotenv: ^5.5
This package is auto-updated.
Last update: 2024-12-20 00:19:25 UTC
README
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
- 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:
- Config - simple implementation using class properties
- EnvironmentConfig - loads configuration values from environment using getenv
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"