Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wp-builder
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
wpdesk
wp-builder
Merge requests
!31
chore(readme): more documentation
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
chore(readme): more documentation
feature/readme
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Krzysztof Dyszczyk
requested to merge
feature/readme
into
master
3 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
👍
0
👎
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
5fe242f0
1 commit,
3 years ago
1 file
+
64
−
0
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
README.md
0 → 100644
+
64
−
0
Options
[

](https://gitlab.com/wpdesk/wp-builder/pipelines)
[

](https://gitlab.com/wpdesk/wp-builder/commits/master)
[

](https://packagist.org/packages/wpdesk/wp-builder)
[

](https://packagist.org/packages/wpdesk/wp-builder)
[

](https://packagist.org/packages/wpdesk/wp-builder)
[

](https://packagist.org/packages/wpdesk/wp-builder)
WP Builder
==========
wp-builder defines interfaces and abstracts to create WordPress plugins.
## Requirements
PHP 5.6 or later.
## Installation via Composer
In order to install the bindings via
[
Composer
](
http://getcomposer.org/
)
run the following command:
```
bash
composer require wpdesk/wp-builder
```
## Example usage
Use this code in main WordPress plugin file:
```
php
<?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
);
```
Loading