定制 laravel-notification-channels/pushbullet 二次开发

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

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

laravel-notification-channels/pushbullet

Composer 安装命令:

composer require laravel-notification-channels/pushbullet

包简介

Laravel 5.3+ Notifications Pushbullet Driver

README 文档

README

Pushbullet notification channel for Laravel

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

This package makes it easy to send notifications using Pushbullet with Laravel 5.5+, 6.x, 7.x and 8.x.

Contents

Installation

To get the latest version of Pushbullet Notification channel for Laravel 5.3, simply require the project using Composer:

$ composer require laravel-notification-channels/pushbullet

Or you can manually update your require block and run composer update if you choose so:

{
    "require": {
        "laravel-notification-channels/pushbullet": "^1.0"
    }
}

Setting up the Pushbullet service

In your pushbullet account go to Account settings page. Click Create Access Token button and you will get access_token.

You need to put it to config/services.php configuration file. You may copy the example configuration below to get started:

'pushbullet' => [
    'access_token' => env('PUSHBULLET_ACCESS_TOKEN')
]

Usage

Routing Pushbullet notifications

In order to send notifications to Pushbullet you need to specify recipient for each notifiable entity. There are currently 2 options: pushbullet email or device id of recipient. To provide library with correct notification recipient you need to define routeNotificationForPushbullet method on notifiable entity.

Sending notification to email:

public function routeNotificationForPushbullet()
{
    return new \NotificationChannels\Pushbullet\Targets\Email($this->email);
}

Sending notification to device id:

public function routeNotificationForPushbullet()
{
    return new \NotificationChannels\Pushbullet\Targets\Device($this->pushbullet_device_id);
}

Sending notification to all subscribers of channel that has tag:

public function routeNotificationForPushbullet()
{
    return new \NotificationChannels\Pushbullet\Targets\Channel($this->channel_tag);
}

Sending notification to all of the user's devices

public function routeNotificationForPushbullet()
{
    return new \NotificationChannels\Pushbullet\Targets\UserDevices();
}

via Method

On notification entity just add \NotificationChannels\Pushbullet\PushbulletChannel::class item to array that is returned from via method.

toPushbullet Method

In your notification class you also should define toPushbullet method which will return instance of \NotificationChannels\Pushbullet\PushbulletMessage.

/**
 * Get the pushbullet representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return \NotificationChannels\Pushbullet\PushbulletMessage
 */
public function toPushbullet($notifiable)
{
    $url = url('/invoice/' . $this->invoice->id);

    return PushbulletMessage::create('Thank you for using our application!')
        ->link()
        ->title('One of your invoices has been paid!')
        ->url($url);
}

Available Message methods

  • note(): set notification type to note (title and message for notification are available)
  • link(): set notification type to link (title, message and url are available)
  • title($title): (string) set notification title
  • message($message): (string) set notification message
  • url($url): (string) set notification url (will be in notification if type is link)

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

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

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 10.15k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 14
  • 点击次数: 36
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 4
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-13