PHPackages                             sackrin/laravel-meta-fields - 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. sackrin/laravel-meta-fields

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

sackrin/laravel-meta-fields
===========================

Customisable meta fields for laravel models

315

Since Nov 30Compare

[ Source](https://github.com/hilaryosborne/laravel-meta-fields)[ Packagist](https://packagist.org/packages/sackrin/laravel-meta-fields)[ RSS](/packages/sackrin-laravel-meta-fields/feed)WikiDiscussions Synced 5d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Meta Fields
===================

[](#laravel-meta-fields)

Laravel meta fields attempts to bring the powerful concept of the popular WordPress plugin advanced custom fields into Laravel for quick rich content and management form field creation. Meta field schemas are attached to models and provide rich content fields such as text, dropdown, wysiwyg which can be managed and searched. The idea is not to replace model properties but to extend models with customisable content focused meta values using a simplied meta table of key value pairs.

Quickstart
----------

[](#quickstart)

The model

```

namespace Example\Person\Model;

use Sackrin\Meta\Model\HasMetaFields;
use Sackrin\Meta\Model\MetaModel;
use Sackrin\Meta\Field\Blueprint;
use Sackrin\Meta\Field\Type\Group;
use Sackrin\Meta\Field\Type\Repeater;
use Sackrin\Meta\Field\Type\Text;

class Person extends Model implements MetaModel {

    use HasMetaFields;

    protected $table = 'people';

    /**
     * Indicates which model is responsible for this model's meta fields
     */
    public static $metaModel = PersonMeta::class;

    /**
     * Provide the meta fields blueprint
     * This object should contain all of the meta fields for this model
     */
    public static function fieldMetaBlueprint() {
        // Return the build field schema object
        return (new Blueprint())
            ->addBlueprint((new Text('company')))
            ->addBlueprint((new Group('details'))
                ->addBlueprint((new Text('first_name')))
                ->addBlueprint((new Text('surname')))
                ->addBlueprint((new Repeater('phones'))
                    ->addBlueprint((new Text('phone_number')))
                    ->addBlueprint((new Text('phone_area')))
                )
                ->addBlueprint((new Repeater('emails'))
                    ->addBlueprint((new Text('emailaddress')))
                )
            );
    }

}

```

```
    // Add to a migration to create the model table
    Schema::create('people', function (Blueprint $table) {
        $table->increments('id');
        $table->timestamps();
    });

```

Supporting meta model. Each model should have it's own meta model

```

namespace Example\Person\Model;

use Illuminate\Database\Eloquent\Model;

class PersonMeta extends Model {

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['machine', 'reference', 'path', 'position', 'type', 'value'];

    /**
     * Get the owner of the meta field
     */
    public function person()
    {
        return $this->belongsTo('Example\Person\Model\Person');
    }

}

```

```
    // Add to a migration to create the model meta table
    Schema::create('people_meta', function (Blueprint $table) {
        $table->increments('id');
        $table->integer('people_id')->unsigned();
        $table->foreign('people_id')->references('id')->on('tutelage_activities');
        $table->text('machine');
        $table->text('reference');
        $table->text('path');
        $table->integer('position');
        $table->string('type');
        $table->longText('value')->nullable();
        $table->timestamps();
    });

```

Set field

```
// Create or retrieve a person record then...
$person->setField('company', 'Acme Co.');
$person->save();

```

Get field

```
// Create or retrieve a person record then...
$person->getField('company');

```

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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/0ae6828a8c4d871370b503e3caf597778a1749830555440fa65926dfe0c79326?d=identicon)[sackrin](/maintainers/sackrin)

### Embed Badge

![Health badge](/badges/sackrin-laravel-meta-fields/health.svg)

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

###  Alternatives

[phpdocumentor/reflection-docblock

With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.

9.4k762.0M1.7k](/packages/phpdocumentor-reflection-docblock)[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k121.2M789](/packages/symfony-maker-bundle)[daveross/offline-country-reverse-geocoder

Determine which country a lat/long point falls in

2330.2k](/packages/daveross-offline-country-reverse-geocoder)

PHPackages © 2026

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