Download the PHP package laravel-notification-channels/twilio without Composer
On this page you can find all versions of the php package laravel-notification-channels/twilio. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download laravel-notification-channels/twilio
More information about laravel-notification-channels/twilio
Files in laravel-notification-channels/twilio
Package twilio
Short Description Provides Twilio notification channel for Laravel
License MIT
Informations about the package twilio
Twilio notifications channel for Laravel
This package makes it easy to send Twilio notifications with Laravel 11.x
Contents
- Installation
- Usage
- Available Message methods
- Changelog
- Testing
- Security
- Contributing
- Credits
- License
Installation
You can install the package via Composer:
Configuration
Add your Twilio Account SID, Auth Token, and From Number (optional) to your .env
:
Advanced configuration
Run php artisan vendor:publish --provider="NotificationChannels\Twilio\TwilioProvider"
Suppressing specific errors or all errors
Publish the config using the above command, and edit the ignored_error_codes
array. You can get the list of
exception codes from the documentation.
If you want to suppress all errors, you can set the option to ['*']
. The errors will not be logged but notification
failed events will still be emitted.
Recommended Configuration
Twilio recommends always using a Messaging Service because it gives you access to features like Advanced Opt-Out, Sticky Sender, Scaler, Geomatch, Shortcode Reroute, and Smart Encoding.
Having issues with SMS? Check Twilio's best practices.
Upgrading from 3.x to 4.x
We have dropped support for PHP < 8.2 and the minimum Laravel version is now 11. Other than that, there are no breaking changes.
Upgrading from 2.x to 3.x
If you're upgrading from version 2.x
, you'll need to make sure that your set environment variables match those above
in the config section. None of the environment variable names have changed, but if you used different keys in your
services.php
config then you'll need to update them to match the above, or publish the config file and change the
env
key.
You should also remove the old entry for twilio
from your services.php
config, since it's no longer used.
The main breaking change between 2.x
and 3.x
is that failed notification will now throw an exception unless they are
in the list of ignored error codes (publish the config file to edit these).
You can replicate the 2.x
behaviour by setting 'ignored_error_codes' => ['*']
, which will case all exceptions to be
suppressed.
Usage
Now you can use the channel in your via()
method inside the notification:
You can also send an MMS:
Or create a Twilio call:
In order to let your Notification know which phone are you sending/calling to, the channel will look for the phone_number
attribute of the Notifiable model. If you want to override this behaviour, add the routeNotificationForTwilio
method to your Notifiable model.
Available Message methods
TwilioSmsMessage
from('')
: Accepts a phone to use as the notification sender.content('')
: Accepts a string value for the notification body.messagingServiceSid('')
: Accepts a messaging service SID to handle configuration.
TwilioCallMessage
from('')
: Accepts a phone to use as the notification sender.url('')
: Accepts an url for the call TwiML.
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
- Philip Iezzi (Pipo)
- Pascal Baljet
- Gregorio Hernández Caso
- atymic
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of twilio with dependencies
twilio/sdk Version ^7.16 || ^8.3
illuminate/notifications Version ^11.0
illuminate/support Version ^11.0
illuminate/events Version ^11.0
illuminate/queue Version ^11.0