定制 wp-media/event-manager 二次开发

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

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

wp-media/event-manager

最新稳定版本:4.0.1

Composer 安装命令:

composer require wp-media/event-manager

包简介

Event Management System for WordPress

README 文档

README

Event management system for WordPress

Overview

This event management system provides a centralized way to handle WordPress hooks (actions and filters) through an event subscriber pattern. It allows you to organize hook callbacks into dedicated subscriber classes, making your WordPress code more maintainable and testable by decoupling hook registration from business logic.

Purpose

This system provides a robust and scalable solution for managing events within WordPress, following best practices for event-driven architecture.

Installation

Install via Composer:

composer require wp-media/event-manager

Initialization

Initialize the Event Manager in your WordPress plugin or theme:

use WPMedia\EventManager\EventManager;
use WPMedia\EventManager\PluginApiManager;

$event_manager = new EventManager(new PluginApiManager());
$event_manager->add_subscriber(new YourEventSubscriber());

Usage

Creating an Event Subscriber

Implement the SubscriberInterface to listen to WordPress hooks:

use WPMedia\EventManager\SubscriberInterface;

class YourEventSubscriber implements SubscriberInterface
{
    public static function get_subscribed_events(): array
    {
        return [
            'init' => 'on_init',
            'wp_enqueue_scripts' => ['on_enqueue_scripts', 10],
        ];
    }

    public function on_init()
    {
        // Handle init hook
    }

    public function on_enqueue_scripts()
    {
        // Handle script enqueuing
    }
}

Reference

Implementation Notes

This implementation adapts the concepts from the referenced article to create a practical event management solution for WordPress applications.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2020-06-05

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固