PHPackages                             sam-it/yii2-jsonbehavior - 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. sam-it/yii2-jsonbehavior

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

sam-it/yii2-jsonbehavior
========================

Advanced AR JSON support

v2.0.0(5y ago)218.4k[10 PRs](https://github.com/SAM-IT/yii2-jsonbehavior/pulls)MITPHPPHP &gt; 7.4

Since Sep 18Pushed 3y ago1 watchersCompare

[ Source](https://github.com/SAM-IT/yii2-jsonbehavior)[ Packagist](https://packagist.org/packages/sam-it/yii2-jsonbehavior)[ RSS](/packages/sam-it-yii2-jsonbehavior/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (3)Dependencies (4)Versions (18)Used By (0)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b200374dced97532c768f70f94207bc1f536586c7c7d579f701fe65f093f866a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f53414d2d49542f796969322d6a736f6e6265686176696f722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/SAM-IT/yii2-jsonbehavior/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/18a1b8f3a866b876a2a741be44d8ebe7ed1c23f0673d3ec9e07cf649e9491429/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f53414d2d49542f796969322d6a736f6e6265686176696f722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/SAM-IT/yii2-jsonbehavior/?branch=master)[![Build Status](https://camo.githubusercontent.com/d47291c49f0bfb1c3f98aada1362a7c3b6fa379889b11548a760d3c19a412ad8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f53414d2d49542f796969322d6a736f6e6265686176696f722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/SAM-IT/yii2-jsonbehavior/build-status/master)[![Total Downloads](https://camo.githubusercontent.com/7beee2641ef88037e55a49105480dc58956226c406203d6129c290ae0dcd376d/68747470733a2f2f706f7365722e707567782e6f72672f73616d2d69742f796969322d6a736f6e6265686176696f722f646f776e6c6f616473)](https://packagist.org/packages/sam-it/yii2-jsonbehavior)[![Latest Stable Version](https://camo.githubusercontent.com/bbdf28d5a6536af32188d21f146ecb8aeb5f8977dc698b4c42e4eb987f6394fd/68747470733a2f2f706f7365722e707567782e6f72672f73616d2d69742f796969322d6a736f6e6265686176696f722f762f737461626c65)](https://packagist.org/packages/sam-it/yii2-jsonbehavior)

Yii2 JsonBehavior
=================

[](#yii2-jsonbehavior)

Work with JSON fields in Yii2

This behavior adds advanced support for working with JSON data in Yii AR models.

Use JSON fields like normal fields
==================================

[](#use-json-fields-like-normal-fields)

Consider a model having a `data` attribute that is stored as JSON.

```
public function behaviors() {
    return [
        ['class' => JsonBehavior::class, 'jsonAttributes' => ['data']]
    ];
}

// Examples:
$model = new Model();
$model->a = "test"; // If attribute 'a' does not exist this is stored inside the data.

$model->a['b'] = 'c']; // Nested arrays are supported.

$model->data = ['x' => 'y']; // Assigning directly is supported.

```

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 95.5% 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 ~164 days

Recently: every ~246 days

Total

7

Last Release

2178d ago

Major Versions

v1.0.5 → v2.0.02020-06-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/18b13c534e3812b66a72645fe215301b54fc4d288f6396fee9385b681e27da18?d=identicon)[SamMousa](/maintainers/SamMousa)

---

Top Contributors

[![SamMousa](https://avatars.githubusercontent.com/u/547021?v=4)](https://github.com/SamMousa "SamMousa (21 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/sam-it-yii2-jsonbehavior/health.svg)

```
[![Health](https://phpackages.com/badges/sam-it-yii2-jsonbehavior/health.svg)](https://phpackages.com/packages/sam-it-yii2-jsonbehavior)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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