PHPackages                             latevaweb/laravel-custom-properties - 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. latevaweb/laravel-custom-properties

ActiveLaravel-package[Database &amp; ORM](/categories/database)

latevaweb/laravel-custom-properties
===================================

Laravel trait to make add dynamic properties to Eloquent models

1.0.3(1y ago)01.3k2[3 PRs](https://github.com/latevaweb/laravel-custom-properties/pulls)MITPHPPHP ^7.3|^8.2|^8.3

Since Jan 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/latevaweb/laravel-custom-properties)[ Packagist](https://packagist.org/packages/latevaweb/laravel-custom-properties)[ Docs](https://github.com/latevaweb/laravel-custom-properties)[ RSS](/packages/latevaweb-laravel-custom-properties/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (3)Versions (10)Used By (0)

Laravel Custom Properties
=========================

[](#laravel-custom-properties)

Trait to add dynamic custom properties to Eloquent models

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/89516378e738b2ae502457e3a5b1808da8e43ffc1fc41b6af718593473139100/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c61746576617765622f6c61726176656c2d637573746f6d2d70726f706572746965732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/latevaweb/laravel-custom-properties/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/d7629ee9d7832f63a81d419620b05f2c7fb0b834bebda92aabefe379f84e3205/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c61746576617765622f6c61726176656c2d637573746f6d2d70726f706572746965732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/latevaweb/laravel-custom-properties/?branch=master)[![Build Status](https://camo.githubusercontent.com/3fee5958bd70d1e6e6aac43fd4e55f8793f4f10b3f8e6adba61c2cb4298ad7af/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c61746576617765622f6c61726176656c2d637573746f6d2d70726f706572746965732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/latevaweb/laravel-custom-properties/build-status/master)[![StyleCI](https://camo.githubusercontent.com/894f080b1cfa8034cea77d304cb129841d444eb155c51331fce22855e0c43a59/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3233313537313736372f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/231571767)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)[![Laravel 6.x](https://camo.githubusercontent.com/8333c1fae9a342ecc33e082cf504539043e98f24028a9df0513db89db6a82d1b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d362e782d6f72616e67652e737667)](http://laravel.com)

Once the trait is installed on the model and migration field is added you can do these things:

```
$customer = new Customer; // An Eloquent model
$customer
   ->setCustomProperty('foo', 'bar')
   ->setCustomProperty('foo2', 'bar2')
   ->save();

$customer->hasCustomProperty('foo'); // Returns 'true'

$customer->getCustomProperty('foo'); // returns 'bar'

$customer->forgetCustomProperty('foo'); // removes field 'foo' from model array

// Don't forget to persist it!

$customer->save();
```

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

[](#installation)

You can install the package via composer:

```
composer require latevaweb/laravel-custom-properties
```

Adding custom properties to a Model
-----------------------------------

[](#adding-custom-properties-to-a-model)

The required steps to add custom properties to a model are:

- First, you need to add the `LaTevaWeb\CustomProperties\HasCustomProperties`-trait.
- It is required to add to your model table the field `$table->json('custom_properties')->nullable();`

Here's an example of a prepared model:

```
use Illuminate\Database\Eloquent\Model;
use LaTevaWeb\CustomProperties\HasCustomProperties;

class NewsItem extends Model
{
    use HasCustomProperties;
}
```

And the migration:

```
Schema::table('your_table', function (Blueprint $table) {
    $table->json('custom_properties')->nullable();
});
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 71.4% 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 ~558 days

Total

4

Last Release

646d ago

PHP version history (2 changes)1.0.0PHP ^7.3

1.0.3PHP ^7.3|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/a7f2911483c33146bb6258128e037aae60f3c4d21414d2894a66a133826c2714?d=identicon)[LaTevaWeb](/maintainers/LaTevaWeb)

---

Top Contributors

[![latevaweb](https://avatars.githubusercontent.com/u/51783643?v=4)](https://github.com/latevaweb "latevaweb (5 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![rafatga](https://avatars.githubusercontent.com/u/3813277?v=4)](https://github.com/rafatga "rafatga (1 commits)")

---

Tags

laraveleloquentattributespropertiesdynamic

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/latevaweb-laravel-custom-properties/health.svg)

```
[![Health](https://phpackages.com/badges/latevaweb-laravel-custom-properties/health.svg)](https://phpackages.com/packages/latevaweb-laravel-custom-properties)
```

###  Alternatives

[wendelladriel/laravel-lift

Take your Eloquent Models to the next level

70046.8k](/packages/wendelladriel-laravel-lift)[highsolutions/eloquent-sequence

A Laravel package for easy creation and management sequence support for Eloquent models with elastic configuration.

121130.3k](/packages/highsolutions-eloquent-sequence)[devio/eavquent

EAV modeling package for Eloquent and Laravel.

6410.4k](/packages/devio-eavquent)

PHPackages © 2026

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