定制 deegitalbe/laravel-trustup-io-notifier 二次开发

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

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

deegitalbe/laravel-trustup-io-notifier

Composer 安装命令:

composer require deegitalbe/laravel-trustup-io-notifier

包简介

This is my package laravel-trustup-io-notifier

README 文档

README

Trustup Pro Notifier

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Compatibility

Laravel Package
8.x / 9.x 1.x
12.x 2.x

Easily send notifications through a centralized notifier instance. Supports emails (Postmak), sms (Vonage/Nexmo), postal letters (Postbird) and push (FCM) via custom notification channels that are easy to use. A single app name and token are enough to use all these channels.

Installation

You can install the package via composer:

composer require deegitalbe/laravel-trustup-io-notifier

You can publish and run the migrations with:

php artisan vendor:publish --tag="laravel-trustup-io-notifier-migrations"
php artisan migrate

You can publish the config file with:

php artisan vendor:publish --tag="laravel-trustup-io-notifier-config"

This is the contents of the published config file:

return [

    /**
     * Sets at which URL the notifier is accessible.
     * Default value: https://notifier.trustup.io
     */
    'url' => env('TPN_URL', 'https://notifier.trustup.io'),

    /**
     * App name (default, invoicing...).
     */
    'app' => env('TPN_APP_NAME', 'default'),

    /**
     * App key
     */
    'key' => env('TPN_APP_KEY')
];

Usage

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class DemoNotification extends Notification implements ShouldQueue
{
    use Queueable;

    public $channels;

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['tpn_sms', 'tpn_email', 'tpn_letter', 'tpn_push', 'database'];
    }
    
    public function toTPNSMS($notifiable): array
    {
        return [
            'to' => '31657616867',
            'text' => 'This is a test SMS'
        ];
    }
    
    public function toTPNEmail($notifiable): array
    {
        return [
            'to' => 'florian.husquinet@deegital.be',
            'html' => '<h1>Demo notification</h1><p>This is my email content...</p>',
            'plain' => 'This is my email content...',
            'subject' => 'Demo notification',
            'headers' => [
                'X-Model-ID' => 1,
                'X-Model-Type' => 'user'
            ]
        ];
    }
    
    public function toTPNPush($notifiable): array
    {
        return [
            'to' => 'f0TAY_cMSpi2nNnakQ_B0w:APA91bFV1-2sblQS1h9mGn6I_aYJEZtww67fCJXN3Ir7V1179q7z_oHDLipQL1KAFs7meUyveVomzi2wLHTYuzXR7rDDnFiOBmCzGFEx-_aRszH0B2lIIelqzBjEjo5cL2t98bZc3B5g',
            'name' => 'demo-notification',
            'title' => 'Demo notification',
            'body' => 'Lorem ipsum...',
            'data' => [
                'type' => 'new-request',
                'id' => '555'
            ]
        ];
    }
    
    public function toTPNLetter($notifiable): array
    {
        return [
            'name' => 'demo-notification',
            'pdf' => 'https://trustup-dev-billing.ams3.digitaloceanspaces.com/202202-2263%20(5).pdf'
        ];
    }
    
    public function toArray($notifiable)
    {
        return [
            'channels' => $this->via($notifiable),
            'to' => '31657616867',
            'text' => 'This is a demo notification'
        ];
    }
}

What happens when you send a notification

The channel will make the API call to the notifier instance for each channel provided with a uuid that is generated then stored in the notification_log_uuids. You can then see how your notification behaved once it was send to the notifier by querying it using that uuid.
Notifications should be sent in queue from your app, as this is always the best possible use. Regardless of what you do in your own app, the notifier will accept the notification and send it to its own queue. There might be a delay of a few seconds before it is handled.

deegitalbe/laravel-trustup-io-notifier 适用场景与选型建议

deegitalbe/laravel-trustup-io-notifier 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.9k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 06 月 07 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「deegitalbe」 「laravel-trustup-io-notifier」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 deegitalbe/laravel-trustup-io-notifier 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-07