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

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

arafatkn/laravel-meta
=====================

Save meta with any model.

1.0.0(3y ago)25MITPHPPHP ^7.3|^8

Since Jun 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/arafatkn/laravel-meta)[ Packagist](https://packagist.org/packages/arafatkn/laravel-meta)[ Docs](https://github.com/arafatkn/laravel-meta)[ RSS](/packages/arafatkn-laravel-meta/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (5)Used By (0)

[![Laravel Meta](https://camo.githubusercontent.com/1226ca45d560b63a6ea7ed2922779222ae06471d4b7bd9c6155c77ac250824a8/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c2532304d6574612e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6172616661746b6e2532466c61726176656c2d6d657461267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d536176652b6d657461646174612b2532386b65792532432b76616c75652532392b776974682b616e792b6d6f64656c266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d746167)](https://camo.githubusercontent.com/1226ca45d560b63a6ea7ed2922779222ae06471d4b7bd9c6155c77ac250824a8/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4c61726176656c2532304d6574612e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d6172616661746b6e2532466c61726176656c2d6d657461267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d536176652b6d657461646174612b2532386b65792532432b76616c75652532392b776974682b616e792b6d6f64656c266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d746167)

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

[](#laravel-meta)

[![Latest Stable Version](https://camo.githubusercontent.com/430036e2dd1f056e9bbbadced81441411544995d880b5c95e2d8f3019b338011/68747470733a2f2f706f7365722e707567782e6f72672f6172616661746b6e2f6c61726176656c2d6d6574612f76)](//packagist.org/packages/arafatkn/laravel-meta)[![License](https://camo.githubusercontent.com/dba4eeca415be342495281e1583c43a4fa78d29707dbf9f6285618242cae9889/68747470733a2f2f706f7365722e707567782e6f72672f6172616661746b6e2f6c61726176656c2d6d6574612f6c6963656e7365)](//packagist.org/packages/arafatkn/laravel-meta)[![Total Downloads](https://camo.githubusercontent.com/7b3525b552beef21ccc42a914b0b9b535a10cf8ee971a2e7328fd8cae23392d2/68747470733a2f2f706f7365722e707567782e6f72672f6172616661746b6e2f6c61726176656c2d6d6574612f646f776e6c6f616473)](//packagist.org/packages/arafatkn/laravel-meta)

[![](https://camo.githubusercontent.com/b4003d30c60d0737dc2a8bc4185f7c29159a1c0414dd0c577210a9ccf88cecf0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6172616661746b6e2f6c61726176656c2d6d6574612e737667)](https://github.com/arafatkn/laravel-meta/issues)[![](https://camo.githubusercontent.com/d888060e6bc43d35b979a4730a006a4ba52b429ef5d305c29162fa7db54dc870/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6172616661746b6e2f6c61726176656c2d6d6574612e737667)](https://github.com/arafatkn/laravel-meta/stargazers)[![](https://camo.githubusercontent.com/74454217909b3cd114293b06cce36ff5bcb49918b27f344e0d7fb783af2a0936/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6172616661746b6e2f6c61726176656c2d6d6574612e737667)](https://github.com/arafatkn/laravel-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 arafatkn/laravel-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.

```
Arafatkn\LaravelMeta\MetaServiceProvider::class,
```

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

```
php artisan vendor:publish --provider="Arafatkn\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 `Arafatkn\LaravelMeta\Metable` trait to models where you need.

```
use \Illuminate\Database\Eloquent\Model;
use \Arafatkn\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');
```

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

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

Total

3

Last Release

1182d ago

Major Versions

0.2.0 → 1.0.02023-04-09

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/80309866?v=4)[Arafat Islam](/maintainers/arafatkn)[@arafatkn](https://github.com/arafatkn)

---

Top Contributors

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

---

Tags

laravellaravel-metalaravel-metadatalaravel metameta-packagemodel meta

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[wearepixel/laravel-cart

A cart implementation for Laravel

1374.8k](/packages/wearepixel-laravel-cart)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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