PHP code example of simperfit / twilio-bundle

1. Go to this page and download the library: Download simperfit/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/ */

    

simperfit / twilio-bundle example snippets


$bundles = array(
	// ... other bundles
	new Vresh\TwilioBundle\VreshTwilioBundle(),
);

class TelephoneController extends Controller
{
    public function callAction($me, $maybee)
    {
        //returns an instance of Vresh\TwilioBundle\Service\TwilioWrapper
    	$twilio = $this->get('twilio.api');

        $message = $twilio->account->messages->sendMessage(
	  '+14085551234', // From a Twilio number in your account
	  '+12125551234', // Text any number
	  "Hello monkey!"
	);

        //get an instance of \Service_Twilio
        $otherInstance = $twilio->createInstance('BBBB', 'CCCCC');

        return new Response($message->sid);
    }
}

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

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        //returns an instance of Vresh\TwilioBundle\Service\TwilioWrapper
        $twilio = $this->getContainer()->get('twilio.api');

        $message = $twilio->account->messages->sendMessage(
	  '+14085551234', // From a Twilio number in your account
	  '+12125551234', // Text any number
	  "Hello monkey!"
	);

        //get an instance of \Service_Twilio
        $otherInstance = $twilio->createInstance('BBBB', 'CCCCC');

        print $message->sid;

    }
}