ksfraser/event 问题修复 & 功能扩展

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

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

ksfraser/event

最新稳定版本:v1.0.0

Composer 安装命令:

composer require ksfraser/event

包简介

PSR-14 compliant event system with extended listener management

README 文档

README

A PSR-14 compliant event system with extended listener management capabilities for PHP applications.

Features

  • PSR-14 Compliance: Full compatibility with PSR-14 Event Dispatcher standard
  • Extended Listener Management: Additional methods for advanced listener control
  • Type-Safe: Full PHP 8.1+ type declarations and strict typing
  • Singleton Pattern: Convenient global access through EventManager
  • Plugin Support: Built-in support for plugin lifecycle events

Installation

composer require ksfraser/event

Basic Usage

use Ksfraser\Event\EventManager;
use Ksfraser\Event\MyCustomEvent;

// Dispatch an event
EventManager::dispatchEvent(new MyCustomEvent($data));

// Add a listener
EventManager::on('user.created', function($event) {
    // Handle user creation
});

Creating Custom Events

<?php
use Ksfraser\Event\Event;

class UserCreatedEvent extends Event
{
    public function __construct(
        public readonly int $userId,
        public readonly string $email
    ) {}
}

Advanced Listener Management

use Ksfraser\Event\EventManager;

// Add multiple listeners
EventManager::on('order.processed', [$orderService, 'sendConfirmation']);
EventManager::on('order.processed', 'sendOrderNotification');

// Get listener provider for advanced management
$listenerProvider = EventManager::getInstance()->getListenerProvider();

Requirements

  • PHP 8.1+
  • PSR-14 Event Dispatcher interface

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Ensure all tests pass
  5. Submit a pull request

License

This project is licensed under the GPL v3 License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2026-02-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固