PHPackages                             flashport/laravel-json-marshaller - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. flashport/laravel-json-marshaller

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

flashport/laravel-json-marshaller
=================================

A laravel wrapper for the lib flashport/json-marshaller

v0.12.5(1y ago)11.1k↓100%MITPHPPHP &gt;=8.2

Since Jan 14Pushed 1y ago1 watchersCompare

[ Source](https://github.com/flashport/laravel-json-marshaller)[ Packagist](https://packagist.org/packages/flashport/laravel-json-marshaller)[ RSS](/packages/flashport-laravel-json-marshaller/feed)WikiDiscussions main Synced today

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

Laravel Json Marshaller
=======================

[](#laravel-json-marshaller)

A laravel wrapper for the [json-marshaller](https://github.com/flashport/json-marshaller) lib.

Installation:
-------------

[](#installation)

```
    composer require flashport/laravel-json-marshaller
```

Usage:
------

[](#usage)

There are two main ways of using this lib, it is possible to use existing target cast objects without modifying them, modifying only the model which performs the cast.

### Option 1: Directly on the model

[](#option-1-directly-on-the-model)

On the `$casts` array, specify the `JsonMarshallable::class` and the target class after `:`. This will ensure the target class gets passed as an argument to the Marshaller.

```
/**
 * The attributes that should be cast.
 *
 * @var array
 */
protected $casts = [
    'metadata'      => JsonMarshallable::class . ":" . Metadata::class,
    'customFields'  => JsonMarshallable::class . ":" . CustomField::class,
    'active'        => 'bool',
];
```

### Option 2: On the target classes

[](#option-2-on-the-target-classes)

#### Target class:

[](#target-class)

Make sure to extend the `AsJsonMarshallable` class on your target classes.

```
use LaravelJsonMarshaller\Castables\AsJsonMarshallable;

class CustomField extends AsJsonMarshallable
{
    //...
}
```

#### Model:

[](#model)

On the model, specify only the target class name you want to cast into.

```
/**
 * The attributes that should be cast.
 *
 * @var array
 */
protected $casts = [
    'metadata'      => Metadata::class,
    'customFields'  => CustomField::class,
    'active'        => 'bool',
];
```

###  Health Score

35

—

LowBetter than 81% of packages

Maintenance49

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Recently: every ~45 days

Total

9

Last Release

374d ago

PHP version history (2 changes)v0.0.1PHP &gt;=8.0

v0.11.0PHP &gt;=8.2

### Community

Maintainers

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

---

Top Contributors

[![lscarpi](https://avatars.githubusercontent.com/u/2413555?v=4)](https://github.com/lscarpi "lscarpi (14 commits)")

---

Tags

phpjsonlaravelpackagemarshaller

### Embed Badge

![Health badge](/badges/flashport-laravel-json-marshaller/health.svg)

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

###  Alternatives

[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

589.9k](/packages/sbsaga-toon)[ernysans/laraworld

Countries, Languages and Time Zones Package for Laravel 5.\*

1755.5k](/packages/ernysans-laraworld)

PHPackages © 2026

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