PHPackages                             tf-pro/yii2-mysql-json - 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. tf-pro/yii2-mysql-json

ActiveYii2-extension[Database &amp; ORM](/categories/database)

tf-pro/yii2-mysql-json
======================

extend yii2-ActiveRecord And yii2-ActiveQuery with use mysql json make simple.

1.0.3(5y ago)39MITPHP

Since Feb 2Pushed 5y ago1 watchersCompare

[ Source](https://github.com/taofei-pro/yii2-mysql-json)[ Packagist](https://packagist.org/packages/tf-pro/yii2-mysql-json)[ RSS](/packages/tf-pro-yii2-mysql-json/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

Yii2 Mysql Json
===============

[](#yii2-mysql-json)

The extension yii2-ActiveRecord And yii2-ActiveQuery with use mysql json make simple.

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

[](#installation)

The preferred way to install this extension is through composer.

Either run

> composer require tf/yii2-mysql-json

or add

> "tf-pro/yii2-mysql-json": "~1.0"

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

Basic Usage
-----------

[](#basic-usage)

Your Model file must extend this extension class；

```
use TFPro\Yii2MysqlJson\ActiveRecordJson；

class YourModel extent ActiveRecordJson
{

}

```

Then if you want to use it to search column with json.

### jsonWhere

[](#jsonwhere)

This func like use `Model::find()->where(\[Query::where()\])`; column search is `column->"$.jsonColumn1.jsonColumn2..."`;

```
public function search()
{
    YourModel::findJson()
        ->jsonWhere(['content->"$.en.content"' => 'who'])
        ->jsonWhere(['>', 'content->"$.en.content"' , 'who'])
}

```

### jsonContainsWhere

[](#jsoncontainswhere)

This func Support mysql `JSON_CONTAINS(target, candidate[, path])`; This query is equivalent to the query, but the difference is that the query is an inclusion relation, that is, the field contains the value of the value; Column A multilevel field supporting JSON fields is segmented using '.';

```
public function search()
{
    YourModel::findJson()
        ->jsonContainsWhere('content.en.content', 'who')
}

```

### jsonExtractWhere

[](#jsonextractwhere)

This func Support JSON\_EXTRACT(json\_doc, path\[, path\] ...) in query; Column A multilevel field supporting JSON fields is segmented using '.'; Can use operate to search。

```
public function search()
{
    YourModel::findJson()
        ->jsonContainsWhere('content.en.content', 'who', '>')
}

```

### jsonSelect

[](#jsonselect)

This func Support JSON\_EXTRACT(json\_doc, path) AS `xx` in query select; Column A multilevel field supporting JSON fields is segmented using '.';

```
public function search()
{
    YourModel::findJson()
        ->jsonSelect(['content.en.content', 'content.en.text' => 'tt']])
}

```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Total

4

Last Release

1976d ago

### Community

Maintainers

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

---

Top Contributors

[![taofei-pro](https://avatars.githubusercontent.com/u/28079815?v=4)](https://github.com/taofei-pro "taofei-pro (6 commits)")

---

Tags

jsonmysqlyii2extensionmysql json

### Embed Badge

![Health badge](/badges/tf-pro-yii2-mysql-json/health.svg)

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

###  Alternatives

[tigrov/yii2-pgsql

Improved PostgreSQL schemas for Yii2

3670.5k](/packages/tigrov-yii2-pgsql)[sjaakp/yii2-spatial

Yii2 ActiveRecord supporting MySQL spatial data

1878.8k1](/packages/sjaakp-yii2-spatial)[dmstr/yii2-migrate-command

Console Migration Command with multiple paths/aliases support

31297.1k6](/packages/dmstr-yii2-migrate-command)[dmstr/yii2-db

Database extensions

19656.2k6](/packages/dmstr-yii2-db)

PHPackages © 2026

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