定制 daalvand/pubsub 二次开发

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

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

daalvand/pubsub

Composer 安装命令:

composer require daalvand/pubsub

包简介

A package for pub sub system

README 文档

README

  • This package used to publish and subscribe with Regis or Kafka

installation

install package

run composer require daalvand/pubsub

publish provider

Laravel

  • php artisan vendor:publish --provider="Daalvand\PubSub\PubSubServiceProvider"

Lumen

  • Add the service provider to bootstrap/app.php file:
<?php
//...
/** @var App $app */
$app->register(Daalvand\PubSub\PubSubServiceProvider::class);

Copy the config files from /vendor/daalvand/pubsub/src/config to config directory. Then configure it in /bootstrap/app.php file:

<?php
/** @var App $app */
$app->configure("pub-sub");

USAGE

Publisher

use Daalvand\PubSub\Facades\Publisher;

Publisher::publish('channel_name', $data);

Subscriber

use Daalvand\PubSub\Facades\Subscriber;
use Daalvand\PubSub\Message;

Subscriber::subscribe(['channel_one', 'channel_two'], function (Message $message) {
    switch ($message->getType()) {
    case 'channel_one':
        //a
        break;
    case 'channel_two':
        //b
        break;
    }
}, 'user');

NOTE

Notice that the real channel name is like below: {microservice_name}_{channel_name}_{environment}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固