承接 laravel-notification-channels/pubnub 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

laravel-notification-channels/pubnub

Composer 安装命令:

composer require laravel-notification-channels/pubnub

包简介

PubNub Notifications Channel for Laravel

README 文档

README

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

PubNub Notifications Channel for Laravel 5.5+ & 6.0. This channel allows you to send message payloads as well as push notifications to iOS, Android and Windows using PubNub.

Contents

Installation

composer require laravel-notification-channels/pubnub

Add the service provider to your config/app.php

// config/app.php
'providers' => [
    ...
    NotificationChannels\Pubnub\PubnubServiceProvider::class,
],

Setting up the PubNub service

Add your PubNub Publish Key, Subscribe Key and Secret Key to your config/services.php

// config/services.php
...

'pubnub' => [
    'publish_key'   => env('PUBNUB_PUBLISH_KEY'),
    'subscribe_key' => env('PUBNUB_SUBSCRIBE_KEY'),
    'secret_key'    => env('PUBNUB_SECRET_KEY'),
],

... 

Usage

use NotificationChannels\Pubnub\PubnubChannel;
use NotificationChannels\Pubnub\PubnubMessage;
use Illuminate\Notifications\Notification;

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

    public function toPubnub($notifiable)
    {
        return (new PubnubMessage())
            ->channel('my_channel')
            ->title('My message title')
            ->body('My message body');
    }
}

Alternatively you may supply a channel specifically related to your notifiable by implementing the routeNotificationForPubnub() method.

use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;

class User extends Model
{
    use Notifiable;
    
    public function routeNotificationForPubnub()
    {
        return $this->pubnub_channel;
    }
}

Sending a push notification. You may chain any of the withiOS(), withAndroid() and withWindows() methods to add push notifications to the message with each of the platforms.

use NotificationChannels\Pubnub\PubnubChannel;
use NotificationChannels\Pubnub\PubnubMessage;
use Illuminate\Notifications\Notification;

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

    public function toPubnub($notifiable)
    {
        return (new PubnubMessage())
            ->channel('my_channel')
            ->title('Alert: Jon Doe Sent You A Message')
            ->body('Hi')
            ->withiOS(
                (new PubnubMessage())
                    ->sound('default')
                    ->badge(1)
            )
            ->withAndroid(
                (new PubnubMessage())
                    ->sound('notification')
                    ->icon('myicon')
            )
            ->withWindows(
                (new PubnubMessage())
                    ->type('toast')
                    ->delay(450);
            );
    }
}

Available methods

  • channel(''): Specifies the channel the message should be sent to
  • title(''): Sets the title of the message
  • body(''): Sets the body of the message
  • storeInHistory(true): If the message should be stored in the Pubnub history
  • badge(1): Sets the number to display on the push notification's badge (iOS)
  • sound(''): Sets the sound for the push notification (iOS, Android)
  • icon(''): Sets the push notification icon (Android)
  • type(''): Sets the type of push notification (Windows)
  • delay(450): Sets the delay in seconds for the push notification (Windows)
  • setData($key, $value): Adds any extra data to the payload you may need
  • setOption($key, $value): Sets any option to the push notification (iOS, Android, Windows)
  • withiOS(PubnubMessage $message): Sets the push notification for iOS
  • withAndroid(PubnubMessage $message): Sets the push notification for Android
  • withWindows(PubnubMessage $message): Sets the push notification for Windows

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email wade@iwader.co.uk 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.

laravel-notification-channels/pubnub 适用场景与选型建议

laravel-notification-channels/pubnub 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.1k 次下载、GitHub Stars 达 10, 最近一次更新时间为 2019 年 10 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 laravel-notification-channels/pubnub 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 laravel-notification-channels/pubnub 我们能提供哪些服务?
定制开发 / 二次开发

基于 laravel-notification-channels/pubnub 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2.1k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 2
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-22