PHPackages                             tmf/wp-metabox-helper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tmf/wp-metabox-helper

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

tmf/wp-metabox-helper
=====================

A Pimple service that facilitates the creation of WordPress metaboxes

v0.1.3(11y ago)240MITPHP

Since Nov 26Pushed 11y ago1 watchersCompare

[ Source](https://github.com/tmf/wp-metabox-helper)[ Packagist](https://packagist.org/packages/tmf/wp-metabox-helper)[ RSS](/packages/tmf-wp-metabox-helper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (5)Used By (0)

WordPress Metabox Helper Service
================================

[](#wordpress-metabox-helper-service)

[![Build Status](https://camo.githubusercontent.com/33981ccca8527586b1564101007589885735d02e2e047e2342ee5fa5962750d0/68747470733a2f2f7472617669732d63692e6f72672f746d662f77702d6d657461626f782d68656c7065722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tmf/wp-metabox-helper)

A [Pimple](http://pimple.sensiolabs.org/) service based on the [Hookable Service Provider](https://github.com/tmf/wp-hookable-service) that facilitates the creation of metaboxes for post meta fields. The items in a metabox representing post meta fields are compatible with WordPress revisions and autosaves. This service can be registered in a pimple container and be used in WordPress themes or plugins.

This metabox helper service comes with the following types of items out of the box:

- Text inputs
- Dropdown fields (implemented with [selectize](http://brianreavis.github.io/selectize.js/))
- Textareas
- TinyMCE Editors

Usage
-----

[](#usage)

This service is installable via [Composer](https://getcomposer.org/) and relies on it's class autoloading mechanism. You can package the vendor directory with you theme or plugin, with your WordPress installation or with a setup of your choosing.

1. Create a composer project for your plugin or theme:

    ```
    cd your-plugin-directory
    # install composer phar
    curl -sS https://getcomposer.org/installer | php
    # create a basic composer.json
    ./composer.phar init
    ```
2. Add the metabox helper service as a dependency in your composer.json

    ```
    ./composer.phar require tmf/wp-metabox-helper ~0.1
    ```
3. Create a pimple container and register the metabox helper service

    ```
    // load the vendors via composer autoload
    if (file_exists( __DIR__ . '/vendor/autoload.php')) {
        require_once __DIR__ . '/vendor/autoload.php';
    }

    use Tmf\Wordpress\Service\Metabox\MetaboxServiceProvider,
        Tmf\Wordpress\Service\Metabox\Metabox,
        Tmf\Wordpress\Service\Metabox\Item\InputItem,
        Tmf\Wordpress\Service\Metabox\Item\DropdownItem,
        Tmf\Wordpress\Service\Metabox\Item\EditorItem;

    // create the service container
    $services = new Pimple\Container();

    // register the metabox helper with this service provider. the service is registered with the 'metaboxes' key
    $services->register(new MetaboxServiceProvider());
    ```
4. Add a metabox and some metabox items representing post meta values

    ```
    add_action('admin_init', function () use ($services) {
        // create a metabox for 'post' post types
        $services['metaboxes']['foo'] = new Metabox('Foo', ['post'], 'normal', 'high');

        // add item: the key is the post meta key
        $services['metaboxes']['foo']['text'] = new InputItem(['label' => 'Metatext', 'description' => 'Some description']);
        $services['metaboxes']['foo']['dropdown'] = new DropdownItem([['label' => 'Foo', 'value'=>'foo'], ['label' => 'Bar', 'value'=>'bar']]);
        $services['metaboxes']['foo']['editor'] = new EditorItem();
    });
    ```

Extend
------

[](#extend)

If you want to use your own metabox items, your item must implement the `Tmf\Wordpress\Service\Metabox\Item\MetaboxItemInterface` interface. You can, however, extend any of the available items or the `Tmf\Wordpress\Service\Metabox\Item\TwigTemplateItemRenderer`. If you want to define your own Twig templates for the item rendering, add a Twig loader to the Twig Chain:

```
add_action('add_meta_boxes', function() use ($services) {
    $this->getContainer()->extend('metaboxes.twig.loader', function($loader, $services){
        /** @var Twig_Loader_Chain $loader */
        $loader->addLoader(new Twig_Loader_Filesystem(get_stylesheet_directory() . '/templates/items'));
        return $loader;
    });
}, 95); // additional twig loaders should be registered between priority 90 and 100
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~13 days

Total

4

Last Release

4143d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/216cd4bf21dbff1de4f4a7f2992123132d4cc21f265831ef69bdbc1f5228035e?d=identicon)[tmf](/maintainers/tmf)

---

Top Contributors

[![tmf](https://avatars.githubusercontent.com/u/1573003?v=4)](https://github.com/tmf "tmf (37 commits)")

### Embed Badge

![Health badge](/badges/tmf-wp-metabox-helper/health.svg)

```
[![Health](https://phpackages.com/badges/tmf-wp-metabox-helper/health.svg)](https://phpackages.com/packages/tmf-wp-metabox-helper)
```

###  Alternatives

[stfalcon/tinymce-bundle

This Bundle integrates TinyMCE WYSIWYG editor into a Symfony2 project.

2692.9M24](/packages/stfalcon-tinymce-bundle)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)[leapt/core-bundle

Symfony LeaptCoreBundle

2529.1k4](/packages/leapt-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
