2017 © Pedro Peláez
 

library twiml

Fluent API for Twilio TwiML responses

image

orukusaki/twiml

Fluent API for Twilio TwiML responses

  • Wednesday, November 19, 2014
  • by orukusaki
  • Repository
  • 1 Watchers
  • 4 Stars
  • 298 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

TwiML

This library offers an easy way to generate TwiML responses for Twilio apps, using a nice fluent interface. It doesn't use any magic, so your IDE should be able to autocomplete all method calls as you type., (*1)

Build Status Scrutinizer Code Quality, (*2)

For example:, (*3)

use Orukusaki\TwiML\Voice\Response;

$response = new Response();
$response->say('Thanks for your call');
$response->dial('+441473000000')
         ->withAction('http://www.example.com/twilio/callback');

echo $response;

Will output:, (*4)


<Response>
  <Say>Thanks for your call</Say>
  <Dial action="http://www.example.com/twilio/callback">+441473000000</Dial>
</Response>

It's good for really quick one-liners (php >= 5.4):, (*5)

echo (new Response())->say('Hi');

Will output:, (*6)

<?xml version="1.0"?>
<Response>
  <Say>Hi</Say>
</Response>

More complex responses can be created in function chains:, (*7)

echo (new Response())
    ->say('S\'il vous plaît laissez un message')
        ->withVoice('alice')
        ->withLanguage('fr-FR')
        ->end()
    ->record()
        ->withAction('http://www.example.com/twilio/recording');

Will output:, (*8)

<?xml version="1.0"?>
<Response>
  <Say voice="alice" language="fr-FR">S'il vous pla&#xEE;t laissez un message</Say>
  <Record action="http://www.example.com/twilio/recording"/>
</Response>

You can also set multiple attributes at once:, (*9)

echo (new Response())
    ->dial('+4400000000')
        ->with(['timeout' => 10, 'record' => 'record-from-answer']);

will output:, (*10)

<?xml version="1.0"?>
<Response>
  <Dial timeout="10" record="record-from-answer">+4400000000</Dial>
</Response>

Installing

composer install "orukusaki/twiml"

Contributing

Issues & PRs welcomed on https://github.com/orukusaki/TwiML, (*11)

The Versions

19/11 2014

dev-master

9999999-dev

Fluent API for Twilio TwiML responses

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Peter Smith

twilio twiml fluent

19/11 2014

0.1.2

0.1.2.0

Fluent API for Twilio TwiML responses

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Peter Smith

twilio twiml fluent

07/11 2014

0.1.1

0.1.1.0

Fluent API for Twilio TwiML responses

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Peter Smith

twilio twiml fluent

23/10 2014

0.1.0

0.1.0.0

Fluent API for Twilio TwiML responses

  Sources   Download

MIT

The Requires

  • php >=5.3

 

The Development Requires

by Peter Smith

twilio twiml fluent