Skip to content

Instantly share code, notes, and snippets.

@designly1
Created May 10, 2022 22:55
Show Gist options
  • Save designly1/7a1346883707ee9a9bcf29f2c2dea47c to your computer and use it in GitHub Desktop.
Save designly1/7a1346883707ee9a9bcf29f2c2dea47c to your computer and use it in GitHub Desktop.
<?php
// Required if your environment does not handle autoloading
require __DIR__ . '/vendor/autoload.php';
// Use the REST API Client to make requests to the Twilio REST API
use Twilio\Rest\Client;
// Your Account SID and Auth Token from twilio.com/console
$sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$token = 'your_auth_token';
$client = new Client($sid, $token);
// Use the client to do fun stuff like send text messages!
$client->messages->create(
// the number you'd like to send the message to
'+15558675309',
[
'messagingServiceSid' => 'YOUR_MESSAGING_SERVICE_ID',
// A Twilio phone number you purchased at twilio.com/console
'from' => '+15017250604',
// the body of the text message you'd like to send
'body' => 'Hey Jenny! Good luck on the bar exam!'
]
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment