承接 tombroucke/wp-fluent-hooks 相关项目开发

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

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

tombroucke/wp-fluent-hooks

Composer 安装命令:

composer require tombroucke/wp-fluent-hooks

包简介

A small utility package that provides a modern, fluent interface for adding WordPress action and filter hooks. Chain methods to build your hooks in a more expressive and readable way.

README 文档

README

Filters

Basic usage:

Filter::hook('the_title')
    ->register(fn ($title) => strtoupper($title));

With priority and argument count:

Filter::hook('save_post')
    ->args(3) // Default 1
    ->priority(11) // Default 10
    ->register(function ($postId, $post, $update) {
        // Do something
    });

Actions

Action and Filter share the same API and can be used interchangeably.

Action::hook('init')
    ->register(function () {
        // Do something
    });

Aliases

Assign an alias to reference the hook later:

Action::hook('body_class')
    ->alias('my_custom_body_class')
    ->register(fn ($classes) => array_merge($classes, ['custom-class']));

Deregistering

Remove a registered hook by its alias:

Action::deregister('my_custom_body_class');

If you didn't define an alias, retrieve the auto-generated one from the registered instance:

$filter = Filter::hook('the_title')
    ->register(fn ($title) => strtoupper($title));

$alias = $filter->getAlias();

Filter::deregister($alias);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2026-04-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固