2017 © Pedro Peláez
 

symfony-bundle sms-bundle

Bundle for sending SMS messages

image

progrupa/sms-bundle

Bundle for sending SMS messages

  • Wednesday, November 25, 2015
  • by progrupa
  • Repository
  • 2 Watchers
  • 0 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Progrupa SMS Bundle

Extensible Symfony2 bundle for sending simple SMS messages., (*1)

Installation

The bundle is available via composer, simply call composer require progrupa/sms-bundle:dev-master or add "progrupa/sms-bundle": "dev-master" to your composer.json and then call composer update progrupa/sms-bundle., (*2)

Then enable the bundle in your AppKernel.php:, (*3)

    new Progrupa\SmsBundle\ProgrupaSmsBundle()

Basic configuration

# config.yml
progrupa_sms:
    transport: 'smsapi.pl'

Usage

    $result = $this->get('progrupa.sms')->send('48111222333', 'Text message');
    if ($result->isSuccess) {
        echo "SMS was sent";
    }

Default provider

The bundle provides support for SmsApi.pl messaging service. To use it, You'll need to provide credentials of an active account. This is done through bundle configuration:, (*4)

progrupa_sms:
    smsapi_pl:
        username: YourUsername
        password: YourPassword
        options: 
            from: Awesome Co
            encoding: utf-8

The options section allows to specify any options You wish to pass with send action. Full documentation can be found on the provider's website, (*5)

Custom transport

To support your own SMS provider You need to create a TransportInterface class, declare it as a service and tag with progrupa.sms.transport. Then configure Progrupa Sms Bundle to use Your transport instead of the default one., (*6)

Example transport:, (*7)

use Progrupa\SmsBundle\Model\Result;
use Progrupa\SmsBundle\Model\Sms;
use Progrupa\SmsBundle\Transport\TransportInterface;

class MyAwesomeTransport implements TransportInterface
{
    /**
     * @param Sms $sms Message to be sent
     * @return Result
     */
    public function send(Sms $sms)
    {
        $result = $this->magic->sendSMS($sms->recipient, $sms->message);
        return $result;
    }
}

Example service configuration:, (*8)

    <service id="foo.my_awesome_transport" class="MyAwesomeTransport">
        <arguments>...</arguments>
        <tag name="progrupa.sms.transport" alias="my_awesome_transport" />
    </service>

or, (*9)

services:
    foo.my_awesome_transport:
        class: MyAwesomeTransport
        tags:
            - {name: "progrupa.sms.transport", alias: "my_awesome_transport"}

Example configuration:, (*10)

# config.yml
progrupa_sms:
    transport: 'my_awesome_transport'

Contributions

We are open to pull requests providing new transport support or new features, feel free to contact us., (*11)

The Versions

25/11 2015

dev-master

9999999-dev

Bundle for sending SMS messages

  Sources   Download

proprietary

The Requires

 

The Development Requires

by Dominik Kasprzak

bundle sms