Download the PHP package boyo/laravel-sinch without Composer
On this page you can find all versions of the php package boyo/laravel-sinch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download boyo/laravel-sinch
More information about boyo/laravel-sinch
Files in boyo/laravel-sinch
Package laravel-sinch
Short Description Laravel notifications with Sinch
License MIT
Homepage https://github.com/boyanraichev/laravel-sinch
Informations about the package laravel-sinch
Sinch Notification channel
This package adds a notification channel for Sinch services. You can use it to send SMS messages. Other channels might be available in the future.
Installation
Install through Composer.
Config
Add the following to your services config file.
- log if the messages should be written to a log file
- log_channel the log channel to log messages to
- send if the messages should be sent (production/dev environment)
- bulglish if cyrillic text should be converted to latin letters for SMS messages (cyrillic messages are limited to 67 characters)
- allow_multiple if SMS messages above 160 characters should be allowed (billed as multiple messages)
Send test
To send a test message use the following artisan command:
php artisan sinch:test phone --message='content' --channel=sms
Direct usage
You can instantiate a Boyo\Sinch\SinchMessage
object and send it immediately.
Usage with notifications
-
Create a message file that extends
Boyo\Sinch\SinchMessage
. It can take whatever data you need in the construct and should implement avuild()
method that defines the messages text content - a good practice would be to render a view file, so that your message content is in your views. You should only define the methods for the delivery channels that your are going to use. - In your Notification class you can now include the Sinch channel in the
$via
array returned by thevia()
method.
Within the same Notification class you should also define a method toSms()
:
The channel method is where you define the delivery channel you wish to use.
- sms delivery by sms only (this is the default value, if you omit the channel method)
- other Sinch channels might be available in the future
All versions of laravel-sinch with dependencies
laravel/framework Version >=6.0
guzzlehttp/guzzle Version >=6.3
boyo/bulglish Version *