定制 yieldstudio/laravel-brevo-notifier 二次开发

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

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

yieldstudio/laravel-brevo-notifier

最新稳定版本:1.0.3

Composer 安装命令:

composer require yieldstudio/laravel-brevo-notifier

包简介

Easily send Brevo transactional email and sms with Laravel notifier.

README 文档

README

Laravel Brevo Notifier Package Logo

Build Status Latest Stable Version Total Downloads License

Easily send Brevo transactional email and sms with Laravel.

Installation

You can install the package via composer:

composer require yieldstudio/laravel-brevo-notifier

Configure

Just define these environment variables:

BREVO_KEY=
MAIL_FROM_ADDRESS=
MAIL_FROM_NAME=
BREVO_SMS_SENDER=

Make sure that MAIL_FROM_ADDRESS is an authenticated email on Brevo. You can verify by logging in your Brevo account here https://app.brevo.com/senders

BREVO_SMS_SENDER is limited to 11 for alphanumeric characters and 15 for numeric characters.

You can publish the configuration file with:

php artisan vendor:publish --provider="YieldStudio\LaravelBrevoNotifier\BrevoNotifierServiceProvider" --tag="config"

Usage

Now you can use the channel in your via() method inside the notification:

Send email

<?php

namespace App\Notifications;

use Illuminate\Notifications\Notification;
use YieldStudio\LaravelBrevoNotifier\BrevoEmailChannel;
use YieldStudio\LaravelBrevoNotifier\BrevoEmailMessage;

class OrderConfirmation extends Notification
{
    public function via(): array
    {
        return [BrevoEmailChannel::class];
    }

    public function toBrevoEmail($notifiable): BrevoEmailMessage
    {
        return (new BrevoEmailMessage())
            ->templateId(1)
            ->to($notifiable->firstname, $notifiable->email)
            ->params(['order_ref' => 'N°0000001']);
    }
}

Send SMS

<?php

namespace App\Notifications;

use Illuminate\Notifications\Notification;
use YieldStudio\LaravelBrevoNotifier\BrevoSmsChannel;
use YieldStudio\LaravelBrevoNotifier\BrevoSmsMessage;

class OrderConfirmation extends Notification
{
    public function via(): array
    {
        return [BrevoSmsChannel::class];
    }

    public function toBrevoSms($notifiable): BrevoSmsMessage
    {
        return (new BrevoSmsMessage())
            ->from('YIELD')
            ->to('+33626631711')
            ->content('Your order is confirmed.');
    }
}

Unit tests

To run the tests, just run composer install and composer test.

Contact us

Our team at Yield Studio is ready to welcome you and make every interaction an exceptional experience. You can contact us.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you've found a bug regarding security please mail contact@yieldstudio.fr instead of using the issue tracker.

Credits

License

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

统计信息

  • 总下载量: 29.05k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 8
  • 点击次数: 13
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 未知