PHPackages                             ivanyankov/meta-fields-builder - 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. ivanyankov/meta-fields-builder

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

ivanyankov/meta-fields-builder
==============================

A robust, flexible, and easy-to-use PHP library to quickly create, register, and reuse meta fields and meta boxes configurations, and keep them in your source code repository.

v1.2.3(2mo ago)113GPL-2.0-or-laterPHPPHP &gt;=8.1

Since Oct 5Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/ivanyankov/meta-fields-builder)[ Packagist](https://packagist.org/packages/ivanyankov/meta-fields-builder)[ RSS](/packages/ivanyankov-meta-fields-builder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (8)Used By (0)

WordPress Meta Fields Builder
=============================

[](#wordpress-meta-fields-builder)

A robust, flexible, and easy-to-use PHP library to quickly create, register, and reuse meta fields and meta boxes configurations, and keep them in your source code repository.

Install
-------

[](#install)

Use composer to install:

```
composer require ivanyankov/meta-fields-builder

```

If your project isn't using composer, you can require the `autoload.php` file.

Available Fields
----------------

[](#available-fields)

FieldClassDescriptionText`TextField`Single-line text inputTextarea`TextareaField`Multi-line text input with configurable rowsURL`URLField`URL input with validationNumber`NumberField`Numeric input with min, max and step constraintsSelect`SelectField`Dropdown from key-value option pairsCheckbox`CheckboxField`Single on/off toggleImage`ImageField`WordPress media library uploader (stores attachment ID)Usage
-----

[](#usage)

This should give you a comprehensive view of how to create meta boxes with fields, where you can specify not only the fields themselves but also where these meta boxes should appear.

### Simple Example

[](#simple-example)

```
use Yankov\MetaFieldsBuilder\MetaBox\MetaBoxBuilder;
use Yankov\MetaFieldsBuilder\Fields\TextField;

$fields = [
    new TextField('text_field_name', 'Text Field')
];

$metaBox = MetaBoxBuilder::make('custom_meta_box_id', 'Advanced Custom Meta Box', $fields, 'post');
```

### Using Multiple Field Types

[](#using-multiple-field-types)

```
use Yankov\MetaFieldsBuilder\MetaBox\MetaBoxBuilder;
use Yankov\MetaFieldsBuilder\Fields\TextField;
use Yankov\MetaFieldsBuilder\Fields\TextareaField;
use Yankov\MetaFieldsBuilder\Fields\URLField;
use Yankov\MetaFieldsBuilder\Fields\NumberField;
use Yankov\MetaFieldsBuilder\Fields\SelectField;
use Yankov\MetaFieldsBuilder\Fields\CheckboxField;
use Yankov\MetaFieldsBuilder\Fields\ImageField;

$fields = [
    new TextField('company_name', 'Company Name'),
    new TextareaField('description', 'Description', rows: 6),
    new URLField('website', 'Website URL'),
    new NumberField('rating', 'Rating', min: 0, max: 5, step: 0.1),
    new SelectField('status', 'Status', [
        'active'   => 'Active',
        'inactive' => 'Inactive',
    ]),
    new CheckboxField('featured', 'Featured'),
    new ImageField('logo', 'Logo'),
];

$metaBox = MetaBoxBuilder::make('company_details', 'Company Details', $fields, 'post');
```

### Restricting to a Specific Page

[](#restricting-to-a-specific-page)

```
$metaBox = MetaBoxBuilder::make('page_settings', 'Page Settings', $fields, 'page', $page_id);
```

Retrieving Data
---------------

[](#retrieving-data)

Get the saved data by calling the WordPress `get_post_meta` function:

```
$field_value = get_post_meta($post_id, 'text_field_name', true);
```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance86

Actively maintained with recent releases

Popularity9

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 ~177 days

Recently: every ~221 days

Total

6

Last Release

69d ago

PHP version history (2 changes)v1.0PHP &gt;=7.4

v1.1PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/061aee62ab5a6aab60c312d42dc457c6b6ed250fef59be1908dbff8cf7947c6f?d=identicon)[ivanyankov](/maintainers/ivanyankov)

---

Top Contributors

[![ivanyankov](https://avatars.githubusercontent.com/u/16328288?v=4)](https://github.com/ivanyankov "ivanyankov (1 commits)")

---

Tags

phpwordpress

### Embed Badge

![Health badge](/badges/ivanyankov-meta-fields-builder/health.svg)

```
[![Health](https://phpackages.com/badges/ivanyankov-meta-fields-builder/health.svg)](https://phpackages.com/packages/ivanyankov-meta-fields-builder)
```

PHPackages © 2026

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