techinasia/laravel-stream-notification-channel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

techinasia/laravel-stream-notification-channel

Composer 安装命令:

composer require techinasia/laravel-stream-notification-channel

包简介

Stream Notifications Channel for Laravel 5.3

README 文档

README

Dependency Status Build Status Coverage Status StyleCI Status

Use Laravel 5.3 notifications to send activities to Stream.

Contents

Installation

Install this package with Composer:

composer require techinasia/laravel-stream-notification-channel-notification-channel

Register the service provider in your config/app.php:

NotificationChannels\GetStream\StreamServiceProvider::class

Setting up Stream

This notification channel uses techinasia/laravel-stream to send notifications to Stream.

Publish all the vendor assets:

php artisan vendor:publish

This will create a file called stream.php in the config folder. Create an application via Stream's admin interface and copy the API key and secret to the configuration file.

You can add more applications by adding more key/secret pairs to the configuration file:

'applications' => [
    'main' => [
        'key' => 'key1',
        'secret' => 'secret1',
    ],
    'foo' => [
        'key' => 'foo',
        'secret' => 'bar',
    ],
],

Usage

Send notifications via Stream in your notification:

use NotificationChannels\GetStream\StreamChannel;
use NotificationChannels\GetStream\StreamMessage;
use Illuminate\Notifications\Notification;

class TestNotification extends Notification
{
    public function via($notifiable)
    {
        return [StreamChannel::class];
    }

    public function toStream($notifiable)
    {
        return (new StreamMessage())
            ->actor(1)
            ->verb('like')
            ->object(3)
            ->foreignId('post:42');
    }
}

You need to specify the ID and type of the notifiable by defining a routeNotificationForStream method on the entity:

/**
 * Notification routing information for Stream.
 *
 * @return array
 */
public function routeNotificationForStream()
{
    return [
        'type' => 'user',
        'id' => $this->id,
    ];
}

Available Message methods

  • application(string $application): Sets the application to be used to send the notification.

You can set any attributes of the payload by calling the name of the attribute in camel case with the value as the parameter:

return (new StreamMessage())
    ->actor(1)
    ->verb('like')
    ->object(3);

Changelog

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

Testing

composer test

Security

If you discover any security related issues, please email dev@techinasia.com instead of using the issues tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 14
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-02-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固