wpdesk/wp-builder
Composer 安装命令:
composer require wpdesk/wp-builder
包简介
README 文档
README
WP Builder
wp-builder library defines the interfaces and abstracts to create WordPress plugins.
Requirements
PHP 5.6 or later.
Installation via Composer
In order to install the bindings via Composer run the following command:
composer require wpdesk/wp-builder
Example usage
Use the following code in WordPress plugin's main .php file:
<?php
class ContentExtender implements \WPDesk\PluginBuilder\Plugin\Hookable {
public function hooks() {
add_filter( 'the_content', [ $this, 'append_sample_text_to_content' ] );
}
/**
* @param string $content
* @return string
*/
public function append_sample_text_to_content( $content ) {
return $content . ' Sample text';
}
}
class ExamplePlugin extends \WPDesk\PluginBuilder\Plugin\AbstractPlugin implements \WPDesk\PluginBuilder\Plugin\HookableCollection {
use \WPDesk\PluginBuilder\Plugin\HookableParent;
public function hooks() {
$this->add_hookable( new ContentExtender() );
$this->hooks_on_hookable_objects();
}
}
$plugin_info = new WPDesk_Plugin_Info();
$plugin_info->set_plugin_name( 'Example Plugin' );
$example_plugin = new ExamplePlugin( $plugin_info );
统计信息
- 总下载量: 80.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 31
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2018-04-16