PHPackages                             fhusquinet/laravel-model-json-options - 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. fhusquinet/laravel-model-json-options

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

fhusquinet/laravel-model-json-options
=====================================

Store options as JSON values easily on your models.

3.0.0(4y ago)04.5k1[1 PRs](https://github.com/fhusquinet/laravel-model-json-options/pulls)MITPHPPHP ^8.0CI failing

Since Jul 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/fhusquinet/laravel-model-json-options)[ Packagist](https://packagist.org/packages/fhusquinet/laravel-model-json-options)[ Docs](https://github.com/fhusquinet/laravel-model-json-options)[ RSS](/packages/fhusquinet-laravel-model-json-options/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)Dependencies (5)Versions (8)Used By (0)

Easily store options on your Eloquent models using JSON and a simple API.
=========================================================================

[](#easily-store-options-on-your-eloquent-models-using-json-and-a-simple-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1fa4ac6ca1cd15f3b1fe650a57f7589b7b65fd2c8848e8d9a47ec7379b428dea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666875737175696e65742f6c61726176656c2d6d6f64656c2d6a736f6e2d6f7074696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fhusquinet/laravel-model-json-options)[![Total Downloads](https://camo.githubusercontent.com/0e2f212277e25180fa5fdad82abdda31c7a95b429ebe1e8996a1196b913478fd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666875737175696e65742f6c61726176656c2d6d6f64656c2d6a736f6e2d6f7074696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fhusquinet/laravel-model-json-options)

If you are storing a lot of values, especially booleans, as columns in your database, and if this data is not always the same for each row you might want to consider using a JSON column. To ease up the usage of it, this package provides an easy way API toscope results from your database and getting/setting options. If you are used to Laravel's syntax you will be familiar with this one as well.

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

[](#installation)

You can install the package via composer:

```
composer require fhusquinet/laravel-model-json-options
```

Usage
-----

[](#usage)

Add the HasOptions trait to your wanted models.

```
// App\Models\Article.php

namespace App\Models;

use FHusquinet\ModelOptions\Traits\HasOptions;
use Illuminate\Database\Eloquent\Model;

class Article extends Model
{
    use HasOptions;
```

You should also include the options column to the model's table using a migration.

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

### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Florian Husquinet](https://github.com/fhusquinet)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity73

Established project with proven stability

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

Recently: every ~315 days

Total

6

Last Release

1505d ago

Major Versions

1.0.4 → 2.0.02021-01-19

2.0.0 → 3.0.02022-05-20

PHP version history (2 changes)1.0.0PHP ^7.0

3.0.0PHP ^8.0

### Community

Maintainers

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

---

Tags

fhusquinetlaravel-model-json-options

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fhusquinet-laravel-model-json-options/health.svg)

```
[![Health](https://phpackages.com/badges/fhusquinet-laravel-model-json-options/health.svg)](https://phpackages.com/packages/fhusquinet-laravel-model-json-options)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M345](/packages/psalm-plugin-laravel)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k91.0k1](/packages/mike-bronner-laravel-model-caching)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)[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)
