PHP code example of six-paths / twilio-bundle

1. Go to this page and download the library: Download six-paths/twilio-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

six-paths / twilio-bundle example snippets


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

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
            ]
        );

    }
}

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
            ]
        );
    }
}