Download the PHP package i-rocky/laravel-twilio without Composer
On this page you can find all versions of the php package i-rocky/laravel-twilio. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download i-rocky/laravel-twilio
More information about i-rocky/laravel-twilio
Files in i-rocky/laravel-twilio
Package laravel-twilio
Short Description Twilio Fax, SMS, MMS, Voice Call recording, receiving, sending support for laravel
License MIT
Informations about the package laravel-twilio
laravel-twilio
Installation
Run the following commands
composer require i-rocky/laravel-twilio
php artisan laravel-twilio:install
This should publish the following files
To use
TwilioService.js
runyarn add axios twilio-client
You can add/update/remove/move the files and use as your wish
Setup
Update config/services.php
Update .env
TWIML_APP_SID
- you need to create a TwiML app for calling from browserLARAVEL_TWILIO_BASE_URL
- URL prefix for laravel-twilioLARAVEL_TWILIO_REJECT_CALL_MESSAGE
- reject incoming calls with this message when calling is disabledLARAVEL_TWILIO_REPLY_MESSAGE
- reply to incoming messages, null for no reply
Now you have to set the Webhook URL in Twilio console.
Replace
laravel-twilio
in the Webhook URL with the base URL you've set forLARAVEL_TWILIO_BASE_URL
in.env
Incoming Calls
Go to your phone number configuration from Active Numbers then click on the desired number.
- Under
Voice & Fax
forAccept Incoming
selectVoice Calls
- Under
Configure With
selectWebhooks, TwiML Bins, Functions, Studio, or Proxy
- Under
A Call Comes In
selectWebhook
and set the value tohttps://your-domain.tld/api/laravel-twilio/voice/incoming
Incoming Faxes
Go to your phone number configuration from Active Numbers then click on the desired number.
- Under
Voice & Fax
forAccept Incoming
selectFaxes
- Under
Configure With
selectWebhooks, TwiML Bins, Functions, Studio, or Proxy
- Under
A Fax Comes In
selectWebhook
and set the value tohttps://your-domain.tld/api/laravel-twilio/fax/incoming
Incoming Messages
Go to your phone number configuration from Active Numbers then click on the desired number.
- Under
Configure With
selectWebhooks, TwiML Bins, Functions, Studio, or Proxy
- Under
A Message Comes In
selectWebhook
and set the value tohttps://your-domain.tld/api/laravel-twilio/message/incoming
Outgoing Calls
Go to TwiML Apps list and select desired app or create a new app
- Under
Voice
set theREQUEST URI
tohttps://your-domain.tld/api/laravel-twilio/voice
Usage
Implement Notifiable
Implement notification
If you don't use the
to('+number')
method in your message construction, you must havephone
,phone_number
property orrouteNotificationForTwilio()
method implemented in yourNotifiable
implementation. The number must start with+
followed by country code.If you don't have
username
property definition in your Auth provider model, you must implementlaravelTwilioIdentity()
method to give your agents an identity for calling.
Events
Namespace Rocky\LaravelTwilio\Events
LaravelTwilioIncomingMessage::class
[gives access toIncomingMessage
at$event->getMessage()
]LaravelTwilioIncomingFax::class
[gives access toIncomingFax
at$event->getFax()
]LaravelTwilioMessageSent::class
[gives access toInstanceResource
at$event->getMessage()
and$notifiable
at$event->getNotifiable()
]LaravelTwilioMessageSendingFailed::class
[gives access toException
at$event->getException()
,Notification
at$event->getNotification()
,$notifiable
at$event->getNotifiable()
]LaravelTwilioMessageDeliveryReport::class
[gives access toMessageDeliveryReport
at$event->getReport()
]LaravelTwilioFaxDeliveryReport::class
[gives access toFaxDeliveryReport
at$event->getReport()
]LaravelTwilioInboundCall::class
[gives access toInboundCall
at$event->getCall()
]LaravelTwilioInboundCallRejected::class
[gives access toInboundCall
at$event->getCall()
]LaravelTwilioOutboundCall::class
[gives access toOutboundCall
at$event->getCall()
]LaravelTwilioCallStatusUpdate::class
[gives access toCallStatus
at$event->getStatus()
]LaravelTwilioCallRecord::class
[gives access toCallRecord
at$event->getRecord()
]
All the parameters sent by Twilio are available in the instance passed through Event. Some of the frequently used properties are added for autocomplete support.
Example:
The incoming fax implementation is not tested.
Look into the source code for a clearer understanding.