2017 © Pedro Peláez
 

symfony-bundle twilio-bundle

A Symfony bundle wrapping the Twilio SDK

image

six-paths/twilio-bundle

A Symfony bundle wrapping the Twilio SDK

  • Thursday, November 2, 2017
  • by six-paths
  • Repository
  • 1 Watchers
  • 0 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Twilio Bundle

Installation

Manual Installation

Add this to your composer.json, (*1)

"require": {
    "six-paths/twilio-bundle": "dev-master"
}

Automated Installation

composer require six-paths/twilio-bundle@dev-master, (*2)

Activate the bundle in app/AppKernel.php, (*3)

$bundles = array(
    // ...
    new Sixpaths\TwilioBundle\SixpathsTwilioBundle(),
);

Configuration

Add or include this in your config.yml parameters, (*4)

    sixpaths.twilio.username: <account sid>
    sixpaths.twilio.password: <auth token>
    sixpaths.twilio.spool.enabled: true
    sixpaths.twilio.spool.type: file
    sixpaths.twilio.spool.directory: '%kernel.root_dir%/../app/twilio/spool/'
    sixpaths.twilio.spool.retain: true

    sixpaths.twilio.from: '<phone number>'
    sixpaths.twilio.defaults.to: '<phone number>'

Usage

It is advised to inject this service in to listeners or other services that may need to consume it rather than using $this->get('...'); instead of a controller; however, that option is still available, (*5)

As part of a controller, (*6)

class SomeController extends Controller
{
    public function someAction(/* ...$arguments */)
    {
        $twilio = $this->get('sixpaths.twilio');
        $messages = $twilio->messages;

        $message = $messages->create(
            '+441234567890', // Send a message to this number
            [
                'from' => '+449876543210', // Send the message from this number
                'body' => 'Message Body', // The message to send
            ]
        );

    }
}

As part of a console command, (*7)

class SomeCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this->setName('some:command')
            ->setDescription('A command');
    }

    protected function execute(InterInterface $input, OutputInterface $output)
    {
        $container = $this->getContainer();
        $twilio = $container->get('sixpaths.twilio');
        $messages = $twilio->messages;

        $message = $messages->create(
            '+441234567890', // Send a message to this number
            [
                'from' => '+449876543210', // Send the message from this number,
                'body' => 'Message Body', // The message to send
            ]
        );
    }
}

Commands

This bundle comes with two commands packaged., (*8)

sixpaths:twilio:spool:message:generate

This will allow you to generate messages - spooled or otherwise - to confirm settings. These will be sent to the default phone number (sixpaths.twilio.defaults.to), (*9)

sixpaths:twilio:spool:message:send

This will send any spooled messages and either remove or retain them., (*10)

The Versions

02/11 2017

dev-master

9999999-dev https://github.com/six-paths/twilio-bundle

A Symfony bundle wrapping the Twilio SDK

  Sources   Download

MIT

The Requires

 

The Development Requires

twilio

02/11 2017

0.0.4

0.0.4.0 https://github.com/six-paths/twilio-bundle

A Symfony bundle wrapping the Twilio SDK

  Sources   Download

MIT

The Requires

 

The Development Requires

twilio

30/10 2017

0.0.3

0.0.3.0 https://github.com/six-paths/twilio-bundle

A Symfony bundle wrapping the Twilio SDK

  Sources   Download

MIT

The Requires

 

The Development Requires

twilio

30/10 2017
30/10 2017