bankiru / sms-online
Bindings for sms-online.ru SMS gateway
Installs: 29 008
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 1
Open Issues: 3
Requires
- php: ~5.6 || ~7.0
- guzzlehttp/guzzle: ~6.0
- scaytrase/symfony-sms-delivery-bundle: ~2.1
Requires (Dev)
- phpunit/phpunit: ~5.1
This package is not auto-updated.
Last update: 2022-11-07 15:54:11 UTC
README
PHP binding for sms-online.ru SMS gateway
Installation
composer require bankiru/sms-online
Usage
Standalone
<?php use Bankiru\Sms\SmsOnline\SmsOnline; use Bankiru\Sms\SmsOnline\SmsOnlineTransport; use ScayTrase\SmsDeliveryBundle\Service\ShortMessageInterface; class MySms implements ShortMessageInterface { /* ... */ } $transport = new SmsOnlineTransport( new SmsOnline(new \GuzzleHttp\Client(), 'user', 'pass', 'https://service.qtelecom.ru/public/http/'), 'friendly_man', new \Psr\Log\NullLogger(), '_transaction_prefix' ); $transport->send(new MySms('1234567890', 'message body'));
Symfony
Register bundle to the kernel
class AppKernel extends Kernel { public function registerBundles() { return [ //... new \ScayTrase\SmsDeliveryBundle\SmsDeliveryBundle(); new \Bankiru\Sms\QtSms\QtSmsBundle(), //... ]; } }
Configure the sender
sms_delivery: transport: sms_online.transport sms_online: login: user password: pass url: https://bulk.sms-online.com/ sender: friendly_man transaction_prefix: _transaction_prefx_
Send SMS
class MyController extends Controller { public function sendAction() { $this->get('sms_delivery.sender')->spoolMessage(new MySms('1234567890', 'message body')); } }