pe/component-messenger 问题修复 & 功能扩展

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

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

pe/component-messenger

最新稳定版本:v1.0.0

Composer 安装命令:

composer require pe/component-messenger

包简介

messenger

README 文档

README

The following versions of PHP are supported.

  • PHP 7.4+

Installation

To install, use composer:

php composer.phar require pe/component-messenger

Usage

This package allow you to send templated messages via various channels and services. There are predefined channels to send a chat, mail, sms and push messages. All you need - create integration (described below).

namespace PE\Component\Messenger;

use PE\Component\Messenger\Channel\ChatChannel;
use PE\Component\Messenger\Template\ChatTemplate;

// Example chat (other types has same api)

/* @var $transport TransportInterface */
$transport = '...';// Telegram, Viber, WhatsApp, etc

$channel   = new ChatChannel($transport);
$template  = new ChatTemplate('Hello {{name}}', []);
$recipient = new Recipient('internalID', ['name' => 'John']);

// Send messages and get event collection with results
$events = $channel->send($template, $recipient/*, <other recipients>*/);

// That's all!

Create integration

For create integration you need implement:

  • Factory that implement PE\Component\Messenger\FactoryInterface to create instances from DSN
  • Transport that implement PE\Component\Messenger\TransportInterface to send via specific API
  • (Optionally) Collector that implement PE\Component\Messenger\CollectorInterface to handle webhook calls
  • (Optionally) Validator that implement PE\Component\Messenger\ValidatorInterface to check integration successfully configured on remote side

Now you can use transport directly or integrate to integrations list. For that you need add your factory to PE\Component\Messenger\FactoryMap, maybe via some DI container/framework.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-04-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固