zaxxas/laravel-simple-chat-notification 问题修复 & 功能扩展

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

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

zaxxas/laravel-simple-chat-notification

最新稳定版本:v0.9.3

Composer 安装命令:

composer require zaxxas/laravel-simple-chat-notification

包简介

This package is implemented for notifying to specified chat tools (slack, .etc)

README 文档

README

This repository is a library for Laravel to notify business chat tools. Currently, the following are covered

  • Slack (webhook only)
  • Teams (webhook only)
  • Line ( Line Notify only)

Currently, it can only send notifications synchronously. Asynchronous support will be added in the future.

Usage

  • Move to root directory of target laravel project.

  • Run the commands below

    • Install this library.
      • composer require zaxxas/laravel-simple-chat-notification.
    • Publish config file.
      • php artisan vendor:publish --tag=laravel-simple-chat-notification
  • Change source files below

    • app/ServiceProviders/AppServiceProvider.php
        'providers' => [
            /*
            * Laravel Framework Service Providers...
            */
            Illuminate\Auth\AuthServiceProvider::class,
            ....
            ....
            \Zaxxas\NotifyToChatTools\Providers\NotificationServiceProvider::class, // -> Add this line
        ],
    
        'aliases' => Facade::defaultAliases()->merge([
            ....
            'InterventionImage' => Intervention\Image\Facades\Image::class,
            'NotifyToChat' => Zaxxas\NotifyToChatTools\Facades\NotificationToChatToolFacade::class, // -> Add this line
        ])->toArray(),
    
  • Add environment variables to .env file

    variable content
    NOTIFICATION_TOOL* Target tool name. One from 'slack', 'teams', 'line'
    SLACK_WEBHOOK_URL Webhook url for slack notification
    SLACK_NOTIFICATION_CHANNEL Channel name for slack notification
    SLACK_NOTIFICATION_SENDAR_NAME Sendar name for slack notification
    TEAMS_WEBHOOK_URL Webhook url for Teams
    LINE_API_ENDPOINT Endpoint url for Line Notify API
    LINE_API_TOKEN Token for Line Notify API

    * : required

  • Add logic of notification (for example, like below.)

    \NotifyToChat::notify(
        new NotificationMessageContent(
            title: 'sample title',
            message: 'sample message',
            keyValueFields: ['key1' => 'value1', 'key2' => 'value2'],
        )
    );
    

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-26