PHPackages                             miladev/lara-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. [Utility &amp; Helpers](/categories/utility)
4. /
5. miladev/lara-meta

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

miladev/lara-meta
=================

Save meta with any model.

1.0(2y ago)28MITPHPPHP ^7.3|^8CI passing

Since Aug 13Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/miladev95/lara-meta)[ Packagist](https://packagist.org/packages/miladev/lara-meta)[ Docs](https://github.com/miladev95/lara-meta)[ RSS](/packages/miladev-lara-meta/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Laravel Meta
============

[](#laravel-meta)

[![Latest Stable Version](https://camo.githubusercontent.com/d413c0100b81c7263036c03ec0aeab82365d7c8b1de7f283526b8e5c68677e2f/68747470733a2f2f706f7365722e707567782e6f72672f6d696c616465762f6c6172612d6d6574612f76)](//packagist.org/packages/miladev/lara-meta)[![License](https://camo.githubusercontent.com/e2b43e99efaa2d7d70697bde43908261ba7a0743e50d7c86a1f083b72c831ccf/68747470733a2f2f706f7365722e707567782e6f72672f6d696c616465762f6c6172612d6d6574612f6c6963656e7365)](//packagist.org/packages/miladev/lara-meta)[![Total Downloads](https://camo.githubusercontent.com/5341284c3bf932b1dba3c65888aae4ec08899c30fd30e4bac9c10f5d044462b7/68747470733a2f2f706f7365722e707567782e6f72672f6d696c616465762f6c6172612d6d6574612f646f776e6c6f616473)](//packagist.org/packages/miladev/lara-meta)

[![](https://camo.githubusercontent.com/126cf0c9fadf0c5e05c07dc469b7367079d65b1997836a910a283a2b2f570085/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6d696c6164657639352f6c6172612d6d6574612e737667)](https://github.com/miladev95/lara-meta/issues)[![](https://camo.githubusercontent.com/fcceaff5aac3d06beae5ff2521dc1fed01ad238843dddb647fe41e3887289142/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d696c6164657639352f6c6172612d6d6574612e737667)](https://github.com/miladev95/lara-meta/stargazers)[![](https://camo.githubusercontent.com/9168bf95384a7d2ea0c10aa87ed9d8f81b5ae2139a174f8605b8c964337cbf00/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6d696c6164657639352f6c6172612d6d6574612e737667)](https://github.com/miladev95/lara-meta/network)

Save metadata (key, value) with any model.

---

Sometimes, we may need to store few extra information for some objects. In some situation, it's not good solution to add new columns. This package can solve those issues.

The package will create a table in database named `laravel_metas` with key, value and metable column. However, table name can be changed by updating table\_name in `config/meta.php`. N.B: After changing table\_name, you need to delete the previous table (if exists) from DB and delete the `create_meta_table` row from `migrations` table. Then re-run the `php artisan migrate` command again.

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

[](#installation)

You can install the package via composer:

```
composer require miladev/lara-meta
```

If you are using Laravel Package Auto-Discovery, you don't need you to manually add the ServiceProvider.

#### Without auto-discovery:

[](#without-auto-discovery)

If you don't use auto-discovery, add the below ServiceProvider to the `$providers` array in `config/app.php` file.

```
Miladev\LaravelMeta\MetaServiceProvider::class,
```

If you want to change the meta table name, then first publish the config file.

```
php artisan vendor:publish --provider="Miladev\LaravelMeta\MetaServiceProvider"
```

Then, update the `table_name` value in `config/meta.php`.

Then you can run migration command to create database table.

```
php artisan migrate
```

Usage
-----

[](#usage)

Add `Miladev\LaravelMeta\Metable` trait to models where you need.

```
use \Illuminate\Database\Eloquent\Model;
use \Miladev\LaravelMeta\Metable;

class Post extends Model
{
    use Metable;
}
```

Then you can access like below:

```
$post = Post::withMetas()->first();
```

```
$post = Post::first();
$post->metas;
```

```
$post = Post::first();
$post->saveMeta('meta_key_here', 'value_here');
$post->getMeta('meta_key_here', 'default_value');
$post->updateMeta('meta_key_here', 'value_here_new');
$post->deleteMeta('meta_key_here');
$post->findMeta('value_here');
```

Contribute
----------

[](#contribute)

If you want to contribute, open a pull request by following Laravel contribution guide.

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance50

Moderate activity, may be stable

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1003d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/804b53db0aff0c136bb3b1ead2f1d660ef00e4ce1650aa49e6edf0fc2338921c?d=identicon)[miladev95](/maintainers/miladev95)

---

Top Contributors

[![miladev95](https://avatars.githubusercontent.com/u/35612406?v=4)](https://github.com/miladev95 "miladev95 (12 commits)")

---

Tags

laravel metamiladevmeta-package

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[kirschbaum-development/commentions

A package to allow you to create comments, tag users and more

12369.2k](/packages/kirschbaum-development-commentions)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[glhd/special

1929.4k](/packages/glhd-special)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k2](/packages/bjuppa-laravel-blog)

PHPackages © 2026

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