creonit/sms-bundle

Installs: 1 168

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:symfony-bundle

v2.0.0 2022-03-23 07:44 UTC

This package is auto-updated.

Last update: 2024-11-23 13:39:55 UTC


README

config/packages/creonit_sms.yaml

creonit_sms:
    transport: Creonit\SmsBundle\Transport\SmsTrafficTransport
    transport_config:
      login: 'login'
      password: 'password'

send sms

use Creonit\SmsBundle\Message\SmsMessage;
use Creonit\SmsBundle\Mime\Phone;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class SmsController extends AbstractController
{
    public function smsAction()
    {
        $message = new SmsMessage();

        $message
            ->setContent('Message content')
            ->setTo(new Phone('77777777777'))
            ->addTo(new Phone('77777777778'))
            ->addTo('77777777778');

        $this->dispatchMessage($message);
    }
}
use Creonit\SmsBundle\Message\SmsMessage;
use Creonit\SmsBundle\Mime\Phone;
use Symfony\Component\Messenger\MessageBusInterface;

class SmsSender
{
    protected $messageBus;

    public function __construct(MessageBusInterface $messageBus)
    {
        $this->messageBus = $messageBus;
    }
    
    public function send()
    {
        $message = new SmsMessage();

        $message
            ->setContent('Message content')
            ->setTo(new Phone('77777777777'))
            ->addTo(new Phone('77777777778'))
            ->addTo('77777777778');

        $this->messageBus->dispatch($message);
    }
}