lemonmind/pimcore-message-bundle 问题修复 & 功能扩展

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

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

lemonmind/pimcore-message-bundle

Composer 安装命令:

composer require lemonmind/pimcore-message-bundle

包简介

Pimcore Message Bundle - send notifications to Discord, Google Chat, Slack, Telegram, E-mail or SMS from Pimcore admin panel

README 文档

README

It's Pimcore Bundle to send notifications to Discord, Google Chat, Slack, Telegram, Email or SMS from admin panel inside Pimcore

Installation

First of all you need to add notifier to your config/config.yaml file otherwise bundle won't install properly

framework:
    notifier:
        chatter_transports:
            slack: '%env(SLACK_DSN)%'
            googlechat: '%env(GOOGLECHAT_DSN)%'
            discord: '%env(DISCORD_DSN)%'
            telegram: '%env(TELEGRAM_DSN)%'
        texter_transports:
            smsapi: '%env(SMSAPI_DSN)%'

Then you can install and enable the bundle

composer require lemonmind/pimcore-message-bundle
// config/bundles.php

LemonmindMessageBundle::class => ['all' => true]

And finally in your config/config.yaml file you need to add

lemonmind_message:
    allowed_chatters: googlechat,discord,slack,telegram,email,sms
    classes:
        Pimcore\Model\DataObject\YOUR_CLASS:
            fields_to_send: series,Carclass,country,price,bodystyle,manufacturer
            email_to_send: some@email.com
            sms_to: PHONE_NUMBER

where:

  • YOUR_CLASS: is your class from which notifications will be sent
  • fields_to_send is your class fields separated with coma without space
  • email_to_send is e-mail you want to send notification to
  • sms_to is the phone number to which you want to send the notification

It is possible to add multiple classes from which you can send notifications
You need to specify which chatters should be available using allowed chatters option

Example

lemonmind_message:
    allowed_chatters: googlechat,discord,slack,telegram,email,sms
    classes:
        Pimcore\Model\DataObject\Car:
            fields_to_send: series,Carclass,country,price,bodystyle,manufacturer
            email_to_send: some@email.com
            sms_to: PHONE_NUMBER
        Pimcore\Model\DataObject\Manufacturer:
            fields_to_send: name

After correct installation button for sending the notification should be visible only in your class that you defined earlier

When you click at the button a modal should pop up where you can select where you want to send notification and add additional information to the message.

Asynchronous messages

MessageBundle can send asynchronous messages via Symfony Messenger Component. To do that in your config/config.yaml file you need to add lines below

framework:
    messenger:
        transports:
            async: "%env(MESSENGER_TRANSPORT_DSN)%"
        routing:
            'LemonMind\MessageBundle\Message\CreateNotification': async

Also in your .env file you need to add

MESSENGER_TRANSPORT_DSN=doctrine://default

where:

  • MESSENGER_TRANSPORT_DSN is your messenger transport dsn. It can be redis, RabbitMQ or database

Finally, you need to start consuming messages. To do this in your php container, run this command

php bin/console messenger:consume async

It is not recommended to keep this process for a long time. It's better to use supervisord.

Discord

To integrate this bundle with Discord you need to add dsn in your .env file

DISCORD_DSN=discord://TOKEN@default?webhook_id=ID

where:

  • TOKEN is your secure token of the webhook (returned for Incoming Webhooks)
  • ID is the id of the webhook

Sample message

Google Chat

To integrate this bundle with Google Chat you need to add dsn in your .env file

GOOGLE_CHAT_DSN=googlechat://ACCESS_KEY:ACCESS_TOKEN@default/SPACE?thread_key=THREAD_KEY

where:

  • ACCESS_KEY is your Google Chat webhook access key
  • ACCESS_TOKEN is your Google Chat webhook access token
  • SPACE is the Google Chat space
  • THREAD_KEY is the Google Chat message thread to group messages into a single thread (optional)

Sample message

Slack

To integrate this bundle with Slack you need to add dsn in your .env file

SLACK_DSN=slack://TOKEN@default?channel=CHANNEL

where:

  • TOKEN is your Bot User OAuth Access Token (they begin with xoxb-)
  • CHANNEL is a channel, private group, or IM channel to send message to, it can be an encoded ID, or a name.

Sample message

Telegram

To integrate this bundle with Telegram you need to add dsn in your .env file

TELEGRAM_DSN=telegram://TOKEN@default?channel=CHAT_ID

where:

  • TOKEN is your Telegram token
  • CHAT_ID is your Telegram group chat id (starts with -)

You need to contact BotFather on Telegram to start creating your bot. Then add the bot to the group where you want it to send messages

Sample message

E-mail

To integrate this package with e-mail, you need to prepare as with regular Pimcore e-mail.

Sample message

SMSAPI

To integrate this package with SMSAPI, you need to add dsn in your .env file

SMSAPI_DSN=smsapi://TOKEN@default?from=FROM&fast=FAST&test=TEST

where:

  • TOKEN is your API Token (OAuth)
  • FROM is the sender name
  • FAST setting this parameter to 1 (default 0) will result in sending message with the highest priority which ensures the quickest possible time of delivery. Attention! Fast messages cost more than normal messages.
  • TEST setting this parameter to 1 (default 0) will result in sending message in test mode (message is validated, but not sent).

You can see your account info at https://ssl.smsapi.pl/

lemonmind/pimcore-message-bundle 适用场景与选型建议

lemonmind/pimcore-message-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 36 次下载、GitHub Stars 达 7, 最近一次更新时间为 2022 年 08 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 lemonmind/pimcore-message-bundle 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2022-08-02