Skip to content

Commit c222874

Browse files
author
Craig Dennis
committed
Moves all older new Twiml code samples to VoiceResponse where appropriate
1 parent 96c71d8 commit c222874

File tree

13 files changed

+25
-25
lines changed

13 files changed

+25
-25
lines changed

guides/request-validation-php-lumen/example-2/example-2.5.x.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?php
22

33
use Illuminate\Http\Request;
4-
use Twilio\TwiML;
4+
use Twilio\TwiML\VoiceResponse;
55

66
// Note: $app was changed for $router since Lumen 5.5.0
77
// Reference: https://lumen.laravel.com/docs/5.5/upgrade#upgrade-5.5.0
88

99
$router->post('voice', ['middleware' => 'TwilioRequestValidator',
1010
function() {
11-
$twiml = new TwiML();
11+
$twiml = new VoiceResponse();
1212
$twiml->say('Hello World!');
1313

1414
return response($twiml)->header('Content-Type', 'text/xml');
@@ -19,7 +19,7 @@ function() {
1919
function(Request $request) {
2020
$bodyLength = strlen($request->input('Body'));
2121

22-
$twiml = new TwiML();
22+
$twiml = new VoiceResponse();
2323
$twiml->message("Your text to me was $bodyLength characters long. ".
2424
"Webhooks are neat :)");
2525

guides/voice/gather-dtmf-tones-guide/gather-example-step-0/example.5.x.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// HTTP POST to /voice in our application
44
require_once '/path/to/vendor/autoload.php';
55

6-
use Twilio\TwiML;
6+
use Twilio\TwiML\VoiceResponse;
77

88
// Use the Twilio PHP SDK to build an XML response
9-
$response = new TwiML();
9+
$response = new VoiceResponse();
1010

1111
// Use the <Gather> verb to collect user input
1212
$gather = $response->gather(array('numDigits' => 1));

guides/voice/gather-dtmf-tones-guide/gather-example-step-1/example.5.x.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// HTTP POST to /voice in our application
44
require_once '/path/to/vendor/autoload.php';
55

6-
use Twilio\TwiML;
6+
use Twilio\TwiML\VoiceResponse;
77

88
// Use the Twilio PHP SDK to build an XML response
9-
$response = new TwiML();
9+
$response = new VoiceResponse();
1010

1111
// If the user entered digits, process their request
1212
if (array_key_exists('Digits', $_POST)) {

guides/voice/gather-dtmf-tones-guide/gather-example-step-2.1/example.5.x.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// sent as an HTTP POST to /gather in our application
44
require_once '/path/to/vendor/autoload.php';
55

6-
use Twilio\TwiML;
6+
use Twilio\TwiML\VoiceResponse;
77

88
// Use the Twilio PHP SDK to build an XML response
9-
$response = new TwiML();
9+
$response = new VoiceResponse();
1010

1111
// If the user entered digits, process their request
1212
if (array_key_exists('Digits', $_POST)) {

guides/voice/gather-dtmf-tones-guide/gather-example-step-2/example.5.x.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
// HTTP POST to /voice in our application
44
require_once '/path/to/vendor/autoload.php';
55

6-
use Twilio\TwiML;
6+
use Twilio\TwiML\VoiceResponse;
77

88
// Use the Twilio PHP SDK to build an XML response
9-
$response = new TwiML();
9+
$response = new VoiceResponse();
1010

1111
// Use the <Gather> verb to collect user input
1212
$gather = $response->gather(array('numDigits' => 1, 'action' => '/gather'));

guides/voice/record-calls-guide/record-twiml-transcribe/example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
# Start our TwiML response
7-
$response = new Twilio\TwiML();
7+
$response = new Twilio\TwiML\VoiceResponse();
88

99
# Use <Say> to give the caller some instructions
1010
$response->say('Hello. Please leave a message and I will transcribe it.');

guides/voice/record-calls-guide/record-twiml/example.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
# Start our TwiML response
7-
$response = new Twilio\TwiML();
7+
$response = new Twilio\TwiML\VoiceResponse();
88

99
# Use <Say> to give the caller some instructions
1010
$response->say('Hello. Please leave a message after the beep.');

guides/voice/respond-incoming-calls-guide/respond-with-parameters/example.5.x.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22
require_once './vendor/autoload.php';
3-
use Twilio\TwiML;
3+
use Twilio\TwiML\VoiceResponse;
44

55
$city = $_REQUEST['FromCity'] ?? 'Guayaquil';
66

7-
$response = new TwiML();
7+
$response = new VoiceResponse();
88
$response->say("Never gonna give you up, {$city}!", array('voice' => 'alice'));
99
$response->play("https://demo.twilio.com/docs/classic.mp3");
1010

quickstart/php/sms/example-4/mms-hello-monkey.5.x.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// Get the PHP helper library from https://twilio.com/docs/libraries/php
33
// following the instructions to install it with Composer.
44
require_once "vendor/autoload.php";
5-
use Twilio\TwiML;
5+
use Twilio\TwiML\VoiceResponse;
66

7-
$response = new TwiML();
7+
$response = new VoiceResponse();
88
$message = $response->message();
99
$message->body('Hello, Mobile Monkey');
1010
$message->media('https://demo.twilio.com/owl.png');

quickstart/php/sms/example-7/send-sms-during-call.5.x.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Get the PHP helper library from https://twilio.com/docs/libraries/php
33
// following the instructions to install it with Composer.
44
require_once "vendor/autoload.php";
5-
use Twilio\TwiML;
5+
use Twilio\TwiML\VoiceResponse;
66

77
// make an associative array of callers we know, indexed by phone number
88
$people = array(
@@ -15,7 +15,7 @@
1515
// otherwise, consider them just another monkey
1616
$name = $people[$_REQUEST['From']] ?: 'Monkey';
1717

18-
$response = new TwiML();
18+
$response = new VoiceResponse();
1919
$response->say("Hello {$name}");
2020
$response->message("{$name}, thanks for the call!");
2121

0 commit comments

Comments
 (0)