PHPackages                             codemascot/metabox - 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. codemascot/metabox

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

codemascot/metabox
==================

This is a Composer library package to make easier the process of creating metabox for WordPress.

1.0.1(7y ago)08MITPHP

Since Nov 22Pushed 7y ago1 watchersCompare

[ Source](https://github.com/CodeMascotClub/metabox)[ Packagist](https://packagist.org/packages/codemascot/metabox)[ RSS](/packages/codemascot-metabox/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

CodeMascot MetaBox
==================

[](#codemascot-metabox)

This is a Composer library package to enhance the usage of **WordPress metabox API**.

Table Of Contents
-----------------

[](#table-of-contents)

- [Coding styles and technique](#coding-styles-and-technique)
- [Installation](#installation)
- [Usage](#usage)
- [Crafted by Khan](#crafted-by-khan)
- [License](#license)
- [Contributing](#contributing)

Coding styles and technique
---------------------------

[](#coding-styles-and-technique)

- All input data escaped and validated.
- Developed as *Composer* package.
- **YODA** condition checked.
- Maintained *Right Margin* carefully. Usually that is 80 characters.
- Used `true`, `false` and `null` in stead of `TRUE`, `FALSE` and `NULL`.
- **INDENTATION:** *TABS* has been used in stead of *SPACES*.
- *PHP Codesniffer* checked.
- *WordPress VIP* coding standard followed mostly.

Requirements
------------

[](#requirements)

- WordPress &gt;= 3.8.0 (Tested)
- PHP &gt;= 5.6
- Composer Package Manager

Installation
------------

[](#installation)

The best way to use this package is through Composer:

```
$ composer require codemascot/metabox
```

Usage
-----

[](#usage)

##### Step 1

[](#step-1)

First we need to prepare the arguments like below-

```
$prefix = 'codemascot_'; // Use any prefix you like to prefix the metabox name or id
$metabox_args = [
    [
        $prefix . '-section-title',
        __( 'Section Title', 'text-domain' ),
        'title',
        'required',
    ],
    [
        $prefix . '-checkbox',
        __( 'Input Checkbox', 'text-domain' ),
        'check',
        '',
        [
            'checkbox_key' => 'Checkbox Text',
        ],
    ],
    [
        $prefix . '-input',
        __( 'Input Text', 'text-domain' ),
        'input',
        'required',
    ],
    [
        $prefix . '-select',
        __( 'Select Dropdown', 'text-domain' ),
        'select',
        'required',
        [
            '-'     => '-',
            'red'   => 'Red',
            'blue'  => 'Blue',
            'green' => 'Green',
        ],
    ],
];
```

##### Step 2

[](#step-2)

Now you need to call the `MetaBox` class like below-

```
new \CodeMascot\MetaBox\MetaBox(
    'section-id', // Section DOM ID
    __( 'Section Name', 'text-domain' ), // Section Name
     'post', // Post Type
     $metabox_args, // Arguments
     'advanced', // Context
     'high' // Priority
);
```

##### Data Sanitization &amp; Validation

[](#data-sanitization--validation)

You can use `codeamscot_metabox_api_data_filter` for sanitizing and validating input through this package. It has two arguments, one is `$data` and another is `$field_id`.

```
add_filter(
    'codemascot_metabox_api_data_filter',
    'codemascot_metabox_api_data_filter',
    10,
    2
);

/**
 * @param        $data
 * @param string $field_id
 */
function codemascot_metabox_api_data_filter( $data, $field_id ) {
    // Validate or Sanitize Data Here.
}
```

Crafted by Khan
---------------

[](#crafted-by-khan)

I'm Khan AKA CodeMascot a professional web developer and I crafted this package for my personal use. Feel free to use this for your projects too.

License
-------

[](#license)

Copyright (c) 2018 Khan M Rashedun-Naby, CodeMascot

Good news, this library is free for everyone! Since it's released under the [MIT License](LICENSE) you can use it free of charge on your personal or commercial website.

Contribution
------------

[](#contribution)

All feedback / bug reports / pull requests are welcome.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Total

2

Last Release

2735d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ced16f5d9c5ace6556a030aa6e4ddb87c358ee280b2442fd72075a147bf7440?d=identicon)[codemascot](/maintainers/codemascot)

---

Top Contributors

[![khanrn](https://avatars.githubusercontent.com/u/6243408?v=4)](https://github.com/khanrn "khanrn (15 commits)")

### Embed Badge

![Health badge](/badges/codemascot-metabox/health.svg)

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

PHPackages © 2026

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