承接 dugajean/wp-hook-annotations 相关项目开发

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

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

dugajean/wp-hook-annotations

Composer 安装命令:

composer require dugajean/wp-hook-annotations

包简介

Use PHP Docblock (annotations) to register WordPress hooks, filters and shortcodes.

README 文档

README

Latest Unstable Version Total Downloads License

Use PHP Docblock (annotations) to register WordPress hooks, filters and shortcodes.

Requirements

  • PHP 7.1+

Install

Via Composer

$ composer require dugajean/wp-hook-annotations

Usage

To automatically wire up your class, simply call the HookRegistry::bootstrap method, like so:

<?php

namespace My\CoolNamespace;

use Dugajean\WpHookAnnotations\HookRegistry;
use Dugajean\WpHookAnnotations\Models\Action;

class MyClass
{
    public function __construct(HookRegistry $hookRegistry) 
    {
        $hookRegistry->bootstrap($this);
    }
    
    /**
     * @Action(tag="init")    
     */
    public function doSomething()
    {
        // do something
    }
}

And you're done!

The following annotations can be used:

/**
 * @Action(tag="the hook name", priority=1, accepted_args=1)
 * @Filter(tag="the filter name", priority=1, accepted_args=1)
 * @Shortcode(tag="the shortcode code")
 */

Testing

$ composer test

License

WP Hook Annotations is released under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-06-01