Installation & Setup
To install this package, run the following Composer command:
composer require babdev/laravel-twilioRegister The Package
If your application is not using package discovery, you will need to add the service provider to your config/app.php file.
return [
'providers' => [
BabDev\Twilio\Providers\TwilioProvider::class,
],
];To use the facade, you will also need to register it in your config/app.php file.
return [
'aliases' => [
'TwilioClient' => BabDev\Twilio\Facades\TwilioClient::class,
],
];Publish Resources
If you need to customize the package configuration, you can publish it to your application's config directory with the following command:
php artisan vendor:publish --provider="BabDev\Twilio\Providers\TwilioProvider" --tag="config"Setup
Setting Environment Variables
The below environment variables should be set in your application's .env file:
TWILIO_CONNECTION- The name of the default Twilio API connection for your application; if using a single connection this does not need to be changedTWILIO_NOTIFICATION_CHANNEL_CONNECTION- If using Laravel's notifications system, the name of a Twilio API connection to use in the notification channel (defaulting to your default connection); if using a single connection this does not need to be changedTWILIO_API_SID- The Twilio API SID to use for the default Twilio API connectionTWILIO_API_AUTH_TOKEN- The Twilio API authentication token to use for the default Twilio API connectionTWILIO_API_FROM_NUMBER- The default sending phone number to use for the default Twilio API connection, note the sending phone number can be changed on a per-message basis; this is optional whenTWILIO_API_MESSAGING_SERVICE_SIDis set and the connection is only used to send messagesTWILIO_API_ACCOUNT_SID- (Optional) The SID of the Twilio account to use for the default Twilio API connection; this is required whenTWILIO_API_SIDandTWILIO_API_AUTH_TOKENare an API key's SID and secretTWILIO_API_REGION- (Optional) The Twilio region to send requests for the default Twilio API connection toTWILIO_API_EDGE- (Optional) The Twilio edge location to send requests for the default Twilio API connection throughTWILIO_API_MESSAGING_SERVICE_SID- (Optional) The SID of a Messaging Service to send messages for the default Twilio API connection through; when set, Twilio chooses the sender from the service's sender pool, andTWILIO_API_FROM_NUMBERis still used for callsTWILIO_API_WEBHOOK_TOKEN- (Optional) The auth token of the Twilio account for the default Twilio API connection, used to validate webhook signatures; this is required whenTWILIO_API_SIDandTWILIO_API_AUTH_TOKENare an API key's SID and secret