Skip to content

Commit 88db004

Browse files
authored
clean up twilio sample (GoogleCloudPlatform#289)
1 parent a009bc5 commit 88db004

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

appengine/flexible/twilio/app.php

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121

2222
$app = new Application();
2323

24-
$app['twilio'] = function ($app) {
25-
return new Services_Twilio(
26-
$app['twilio.account_sid'],
27-
$app['twilio.auth_token']
28-
);
29-
};
30-
3124
# [START receive_call]
3225
/***
3326
* Answers a call and replies with a simple greeting.
@@ -43,20 +36,20 @@
4336
});
4437
# [END receive_call]
4538

46-
4739
# [START send_sms]
4840
/***
4941
* Send an sms.
5042
*/
5143
$app->post('/sms/send', function (Request $request) use ($app) {
52-
/** @var Services_Twilio $twilio */
53-
$twilio = $app['twilio'];
44+
$twilio = new Services_Twilio(
45+
$app['twilio.account_sid'], // Your Twilio Account SID
46+
$app['twilio.auth_token'] // Your Twilio Auth Token
47+
);
5448
$sms = $twilio->account->messages->sendMessage(
5549
$app['twilio.number'], // From this number
5650
$request->get('to'), // Send to this number
5751
'Hello from Twilio!'
5852
);
59-
6053
return sprintf('Message ID: %s, Message Body: %s', $sms->sid, $sms->body);
6154
});
6255
# [END send_sms]
@@ -69,7 +62,6 @@
6962
$sender = $request->get('From');
7063
$body = $request->get('Body');
7164
$message = "Hello, $sender, you said: $body";
72-
7365
$response = new Services_Twilio_Twiml();
7466
$response->message($message);
7567
return new Response(

0 commit comments

Comments
 (0)