定制 luisdalmolin/laravel-zenvia-channel 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

luisdalmolin/laravel-zenvia-channel

最新稳定版本:1.1.0

Composer 安装命令:

composer require luisdalmolin/laravel-zenvia-channel

包简介

Send SMS messages with Zenvia

README 文档

README

Latest Version on Packagist Software License Total Downloads

This package makes it easy to send Zenvia SMS messages using Zenvia API with Laravel 5.

Contents

Installation

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,
],

Configuration

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')
],
...

Usage

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');
    }
}

Routing a message

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;
}
...

Available Message methods

  • to($phone): (integer) Recipient's phone.
  • content('message'): (string) SMS message.
  • from('Sender'): (string) Sender's name.
  • id('sms-id'): (string) SMS ID.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email luis.nh@gmail.com instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 354.3k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 18
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 18
  • Watchers: 1
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固