Skip to content

Instantly share code, notes, and snippets.

@JonEastman
Created January 27, 2019 16:29
Show Gist options
  • Save JonEastman/271e6b0d2d19247c300ef794ad1aba0f to your computer and use it in GitHub Desktop.
Save JonEastman/271e6b0d2d19247c300ef794ad1aba0f to your computer and use it in GitHub Desktop.
<?php
foreach ($messages as $message) {
try {
$text = $client->messages->create(
$message->getPhone(),
array(
'from' => ‘+12629577957’,
'body' => ‘Text message here’
)
);
} catch (Twilio\Exceptions\TwilioException $twilioException) {
// Log specific Twilio error & I’d recommend setting some sort of status as failed
} catch (\Exception $exception) {
// Log general error & I’d recommend setting some sort of status as failed
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment