PHPackages                             lao9s/modelmetabox - 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. lao9s/modelmetabox

AbandonedLibrary

lao9s/modelmetabox
==================

:description

051PHP

Since Apr 11Pushed 7y ago1 watchersCompare

[ Source](https://github.com/lao9s/ModelMetaBox)[ Packagist](https://packagist.org/packages/lao9s/modelmetabox)[ RSS](/packages/lao9s-modelmetabox/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel EloquentModel Meta Box
==============================

[](#laravel-eloquentmodel-meta-box)

[![Latest Version on Packagist](https://camo.githubusercontent.com/790d9dc4ae63d9076aba10f6d0602e92542a312b0d19e821e8f15a1415f63da4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c616f39732f6d6f64656c6d657461626f782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lao9s/modelmetabox)[![Total Downloads](https://camo.githubusercontent.com/0c8bad8687c0d87ce0c6e1edc13a8237f8185a8506095d7caea7f5083ae69f57/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c616f39732f6d6f64656c6d657461626f782e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lao9s/modelmetabox)[![Build Status](https://camo.githubusercontent.com/c9e0373091dd2fd0111564fb0a993cae37715c5985b3ff0ff88d856a0f13e9d5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6c616f39732f6d6f64656c6d657461626f782f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/lao9s/modelmetabox)

Add additional columns (meta boxes) to EloquentModel without add columns to the migration file

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

[](#installation)

Via Composer

```
$ composer require lao9s/modelmetabox
```

Usage
-----

[](#usage)

Use the ModelMetaBox trait on the model you intend to track

```
use lao9s\ModelMetaBox\Traits\ModelMetaBoxTrait;

class Article extends Model
{
    use ModelMetaBoxTrait;

    ...
}

```

Publish config file.

```
php artisan vendor:publish --tag=ModelMetaBoxConfig

```

Migrate

```
php artisan migrate

```

Change config file:

```
   // Override the delete method in the model to delete meta boxes before the model is deleted.
   'override_the_delete_method' => true,

```

Here are some code examples:

```
// Add/Update meta box to the article
$article->addMetaBox('author', 'Dima Botezatu');

// Support array data. Object or array data will be automatically converted to json.
// If you have another type of data, you can manually convert it into json by adding the third true parameter
$article->addMetaBox('images', ['image1.jpg', 'image2.jpg', 'image3.jpg']);

// Get meta box by specific key. $withValue parameter will return only value not the model object
$article->getMetaBox('author', $withValue = false)

// Also the meta box model have any methods: getValue, getKey or isJson
// Working only if you get metabox object model
$author = $article->getMetaBox('author')
$author->getValue();
$author->getKey();
$author->isJson();

// Get all meta boxes. $withValue parameter will return only values not the models object
$article->getAllMetaBoxes($withValue = false)

// Remove meta box
$article->removeMetaBox('author');

// Remove all meta boxes
$article->removeAllMetaBoxes();

```

Credits
-------

[](#credits)

- [Dima Botezatu](https://github.com/lao9s)

License
-------

[](#license)

MIT. Please see the [license file](license.md) for more information.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8fcb9c0f11b82c2d048ee1b2d7052fde97932e9970820f93dcc2ed78e6b3bc11?d=identicon)[lao9s](/maintainers/lao9s)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/lao9s-modelmetabox/health.svg)

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

PHPackages © 2026

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