Package Data | |
---|---|
Maintainer Username: | luisdalmolin |
Maintainer Contact: | luis.nh@gmail.com (Luís Dalmolin) |
Package Create Date: | 2016-09-03 |
Package Last Update: | 2023-08-18 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-17 03:01:52 |
Package Statistics | |
---|---|
Total Downloads: | 247,789 |
Monthly Downloads: | 6,546 |
Daily Downloads: | 369 |
Total Stars: | 18 |
Total Watchers: | 2 |
Total Forks: | 9 |
Total Open Issues: | 1 |
This package makes it easy to send Zenvia SMS messages using Zenvia API with Laravel 5.
You can install the package via composer:
composer require luisdalmolin/laravel-zenvia-channel
You must install the service provider:
// config/app.php
'providers' => [
...
NotificationChannels\Zenvia\ZenviaServiceProvider::class,
],
Configure your credentials:
// config/services.php
...
'zenvia' => [
'from' => env('ZENVIA_FROM', 'Laravel Notification Channels'),
'pretend' => env('ZENVIA_PRETEND', false),
'conta' => env('ZENVIA_CONTA', 'YOUR ACCOUNT'),
'senha' => env('ZENVIA_SENHA', 'YOUR PASSWORD')
],
...
You can now use the channel in your via()
method inside the Notification class.
use NotificationChannels\Zenvia\ZenviaChannel;
use NotificationChannels\Zenvia\ZenviaMessage;
use Illuminate\Notifications\Notification;
class InvoicePaid extends Notification
{
public function via($notifiable)
{
return [ZenviaChannel::class];
}
public function toZenvia($notifiable)
{
return ZenviaMessage::create()
->from('Laravel') // optional
->to($notifiable->phone) // your user phone
->content('Your invoice has been paid')
->id('your-sms-id');
}
}
You can either send the notification by providing with the chat id of the recipient to the to($phone) method like shown in the above example or add a routeNotificationForZenvia() method in your notifiable model:
...
/**
* Route notifications for the Telegram channel.
*
* @return int
*/
public function routeNotificationForZenvia()
{
return $this->phone;
}
...
to($phone)
: (integer) Recipient's phone.content('message')
: (string) SMS message.from('Sender')
: (string) Sender's name.id('sms-id')
: (string) SMS ID.Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email luis.nh@gmail.com instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.