codechito/laravel-transmitmessage-channel

dev-master 2020-01-29 02:33 UTC

This package is auto-updated.

Last update: 2024-09-29 05:35:55 UTC


README

请参阅此仓库了解提交通道建议的说明。

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads

此包使用Laravel 5.5+和6.x轻松发送通知,使用TransmitMessage

内容

安装

您可以通过composer安装此包

composer require codechito/laravel-transmitmessage-channel

设置TransmitMessage服务

将环境变量添加到您的config/services.php

// config/services.php
...
'transmitmessage' => [
    'apiKey' => env('TRANSMITMESSAGE_APIKEY'),
],
...

将您的TransmitMessage API密钥添加到您的.env

// .env
...
TRANSMITMESSAGE_APIKEY=
],
...

用法

您可以在通知中的via()方法中使用此通道

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use NotificationChannels\TransmitMessage\TransmitMessageChannel;
use NotificationChannels\TransmitMessage\TransmitMessageMessage;

class SmsSend extends Notification
{
    use Queueable;

    /**
     * Create a new notification instance.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [TransmitMessageChannel::class];
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param  mixed  $notifiable
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toTransmitMessage($notifiable)
    {
        return (new TransmitMessageMessage())
                    ->setMessage('The introduction to the notification.')
                    ->setRecipient('639481234567')
                    ->setSender('SHARKY');
    }
}

可用的消息方法

所有可用选项的列表

变更日志

请参阅CHANGELOG以获取有关最近更改的更多信息。

测试

$ composer test

已知问题

如果您遇到以下错误

 certificate problem: unable to get local issuer certificate

对于生产,我们建议您遵循以下链接来修复这些问题

https://ourcodeworld.com/articles/read/211/unirest-for-php-ssl-certificate-problem-unable-to-get-local-issuer-certificate

但如果您急于工作且仅在本地环境中工作,您只需替换以下内容

  1. 转到 \vendor\transmitmessage\php-client-sdk\src\Configuration.php
  2. https://api.transmitmessage.com/v1/ 替换为 http://api.transmitmessage.com/v1/

这将临时解决问题

安全

如果您发现任何安全相关问题,请通过电子邮件chito@burstsms.com联系,而不是使用问题跟踪器。

贡献

有关详细信息,请参阅CONTRIBUTING

致谢

许可证

MIT许可证(MIT)。请参阅许可证文件以获取更多信息。