stafftastic/laravel-cloudevents
最新稳定版本:2.1.0
Composer 安装命令:
composer require stafftastic/laravel-cloudevents
包简介
A reusable cloudevent system for laravel projects.
README 文档
README
This repo is no longer maintained. We wholly recommend just using the Laravel Kafka package and CloudEvents library directly.
Laravel CloudEvents
A Laravel library to publish Illuminate Events to Kafka.
Installation
Install the package:
composer require stafftastic/laravel-cloudevents
Usage
- Publish config file
php artisan vendor:publish --provider="stafftastic\LaravelCloudEvents\CloudEventServiceProvider"
- Create your applications context:
<?php namespace App\Events; use App\Models\User; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Queue\SerializesModels; use stafftastic\CloudEvents\CloudEventable; use stafftastic\CloudEvents\IsCloudEvent; class UserCreated implements CloudEventable { use Dispatchable; use InteractsWithSockets; use SerializesModels; use IsCloudEvent; /** * Create a new event instance. * * @param \Domain\Users\Models\User $user * * @return void */ public function __construct(public User $user) { } public function getCloudEventType(): string { return 'com.stafftastic.users.created'; } public function getCloudEventTopic(): string { return 'stafftastic'; } public function toCloudEventData(): array { return [ 'user' => $this->user, ]; } }
统计信息
- 总下载量: 13.71k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-09-06