PHPackages                             optimuscms/meta - 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. [Database &amp; ORM](/categories/database)
4. /
5. optimuscms/meta

ActiveLibrary[Database &amp; ORM](/categories/database)

optimuscms/meta
===============

Store meta data for the web against your Laravel Models

v1.1.1(6y ago)0331PHPPHP ^7.1.3

Since Aug 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/optimuscms/meta)[ Packagist](https://packagist.org/packages/optimuscms/meta)[ RSS](/packages/optimuscms-meta/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (3)Versions (5)Used By (1)

Meta
====

[](#meta)

Provides a standardised approach to attaching website meta data to Laravel Models. Typically this is used for entities such as Pages, Blog Posts, Events, etc, which will need fields like 'Meta Title', 'Meta Description', and 'OG Image' when they are presented on the web.

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

[](#installation)

You can install the package via composer:

```
composer require optimuscms/meta
```

Once installed, you should add the tables used by this package to your database:

```
php artisan migrate
```

Key concepts
------------

[](#key-concepts)

There are a few key concepts that should be understood before continuing:

- A new model called Meta will be attached to whichever Models you define as requiring meta data.
- It is a 'has one' relationship where the Model can have zero or one Meta Model attached to it.
- The Meta Model depends on the [optimuscms/media](https://github.com/optimuscms/media) package in order to attach images to it.

Usage
-----

[](#usage)

1. Add the `HasMeta` trait to whatever Model you want to collect meta data for:

    ```
    class MyModel extends Model
    {
        use Optix\Meta\HasMeta;
    ```
2. Add a boot method to your Model (if it doesn't already exist) with the following content:

    ```
    protected static function boot()
    {
        parent::boot();

        static::saved(function ($model) {
            /** @var HasMeta $model */
            $model->saveMeta(request('meta'));
        });
    }
    ```
3. (Optional) If your Model appears in an API response, you'll want to add the meta property (either to the Model directly, or in a Resource class if you're using one):

    ```
    public function toArray()
    {
       return [
           ...other properties,
           'meta' => $this->meta,
       ];
    }
    ```
4. When creating or updating your model (eg. from a CMS action), make sure your form submits its request in the following format:

    ```
    {
        ...MODEL_FIELDS,
        meta: {
            title, // max 100 chars
            description, // max 200 chars
            og_title, // max 100 chars
            og_description, // max 200 chars
            og_image_id, // the id of a Media Model
            custom_tags // free text field for adding custom HTML
        }
    }
    ```

    All fields are optional and this package will automatically pick them up and process them as required.

Retrieving OG images
--------------------

[](#retrieving-og-images)

This package also provides a convenient way to retrieve the OG image as a Media Model:

```
$media = $myModel->meta->getOgImage();
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

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

Total

4

Last Release

2466d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1c751a806a8c52afaca5c461326a0799033af6dc94f9ff1f4ee767565d7f83b7?d=identicon)[optimuscms](/maintainers/optimuscms)

---

Top Contributors

[![coatesap](https://avatars.githubusercontent.com/u/1926626?v=4)](https://github.com/coatesap "coatesap (22 commits)")

### Embed Badge

![Health badge](/badges/optimuscms-meta/health.svg)

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

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[abbasudo/laravel-purity

elegant way to add filter and sort in laravel

514330.5k1](/packages/abbasudo-laravel-purity)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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