承接 sammy-boy/eventbus-core 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

sammy-boy/eventbus-core

最新稳定版本:v1.0.2

Composer 安装命令:

composer require sammy-boy/eventbus-core

包简介

Reusable event bus infrastructure for Laravel microservices

README 文档

README

Repository: https://github.com/sammy-boy/eventbus-core

# SammyBoy EventBus Core

Reusable, opinionated Event Bus infrastructure for Laravel microservices.

Built for scalable, event-driven architectures using RabbitMQ and Redis-backed idempotency.

---

## Features

- Standardized event envelope (meta + data)
- Automatic idempotency protection (Redis)
- RabbitMQ publisher with confirmations
- Config-driven consumer
- Dead Letter Exchange support
- Slow-event monitoring
- Laravel auto-discovery support
- Production-ready defaults with flexibility

---

## Installation

```bash
composer require sammy-boy/eventbus-core

Configuration

Publish configuration:

php artisan vendor:publish --tag=eventbus-config

Example:

return [

    'exchanges' => [
        'auth.events',
        'business.events',
    ],

    'queues' => [
        [
            'name' => 'auth_ms.business_events',
            'exchange' => 'business.events',
            'routing_keys' => [
                'tenant.registration.initiated',
            ],
        ],
    ],

    'handlers' => [
        'tenant.registration.initiated' => ProcessTenantCreation::class,
    ],

];

Publishing Events

use SammyBoy\EventBus\RabbitMQService;

$eventBus->publish(
    exchange: 'business.events',
    routingKey: 'tenant.registration.initiated',
    data: [
        'auth_user_id' => 12,
        'email' => 'user@example.com',
    ]
);

Envelope automatically becomes:

{
  "meta": {
    "id": "...",
    "type": "tenant.registration.initiated",
    "source": "auth-service",
    "timestamp": "...",
    "correlation_id": "..."
  },
  "data": { ... }
}

Consuming Events

Run:

php artisan eventbus:consume

Options:

php artisan eventbus:consume --queue=auth_ms.business_events
php artisan eventbus:consume --exchange=business.events

Idempotency

Prevents duplicate event execution.

Configured via:

'idempotency' => [
    'enabled' => true,
    'ttl' => 3600,
    'redis_prefix' => 'event:processed:',
],

Monitoring

Detect slow events:

'monitoring' => [
    'enabled' => true,
    'slow_event_threshold' => 5000, // ms
],

Architecture Philosophy

Opinionated but flexible.

This package enforces:

  • Standardized event structure
  • Config-driven topology
  • Explicit handler mapping

But allows:

  • Custom queue naming
  • Custom exchanges
  • Retry behavior overrides
  • Dead-letter configuration
  • Performance tuning

Requirements

  • PHP 8.4+
  • Laravel 11 / 12+
  • RabbitMQ
  • Redis

License

MIT

Author

Sammy Orondo Lead Developer — SammyBoy https://github.com/sammy-boy

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固