PHPackages                             skobka/yii2-json-field - 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. skobka/yii2-json-field

ActiveYii2-extension[Parsing &amp; Serialization](/categories/parsing)

skobka/yii2-json-field
======================

Help you to define fields, that can contains json. Json in this fields would be automatically serialized and deserialized

v1.0.3(9y ago)32.4k↓66.7%Apache-2.0PHP

Since Feb 3Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Doka-NT/yii2-json-field)[ Packagist](https://packagist.org/packages/skobka/yii2-json-field)[ RSS](/packages/skobka-yii2-json-field/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

Yii2 JSON Field
===============

[](#yii2-json-field)

Help you to define fields, that can contains json. Json in this fields would be automatically serialized and deserialized

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require skobka/yii2-json-field

```

or add

```
"skobka/yii2-json-field": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

```
### Product.php

/**
 * @property object|array|null $field1
 */
class Product extends AvtiveRecord {
   use JsonFieldTrait;

   public function behaviors()
   {
        return [
            'field1' => [
                'class' => JsonFieldBehavior::class,
                'dataField' => 'json_field_1', // this is the name of field in db table
            ],
        ];
   }
}

### ProductController.php
// saving
$product = Product::findOne(['id' => 1]);

$product->field1 = new \StdClass();
$product->field1->foo = 'bar';
$product->save();

$product = Product::findOne(['id' => 1]);
print $product->field1->foo; // bar
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

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

Total

3

Last Release

3390d ago

### Community

Maintainers

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

---

Top Contributors

[![Doka-NT](https://avatars.githubusercontent.com/u/844017?v=4)](https://github.com/Doka-NT "Doka-NT (10 commits)")

---

Tags

jsonyii2extensionfield

### Embed Badge

![Health badge](/badges/skobka-yii2-json-field/health.svg)

```
[![Health](https://phpackages.com/badges/skobka-yii2-json-field/health.svg)](https://phpackages.com/packages/skobka-yii2-json-field)
```

###  Alternatives

[kdn/yii2-json-editor

JSON editor widget (josdejong/jsoneditor) for Yii 2.

22570.0k3](/packages/kdn-yii2-json-editor)[nizsheanez/yii2-json-rpc

A lightweight JsonRpc Server and Client for PHP

2034.0k](/packages/nizsheanez-yii2-json-rpc)

PHPackages © 2026

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