PHPackages                             fgh151/yii2-postgresql-array-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. [Database &amp; ORM](/categories/database)
4. /
5. fgh151/yii2-postgresql-array-field

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

fgh151/yii2-postgresql-array-field
==================================

Yii2 postgresql jsonb field support behavior

v0.0.2(1mo ago)089MITPHPPHP &gt;=8.2.0CI passing

Since Oct 7Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/fgh151/yii2-postgresql-array-field)[ Packagist](https://packagist.org/packages/fgh151/yii2-postgresql-array-field)[ RSS](/packages/fgh151-yii2-postgresql-array-field/feed)WikiDiscussions master Synced 6d ago

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

yii2-postgresql-array-field
===========================

[](#yii2-postgresql-array-field)

Yii2 postgresql object field support behavior

================

Provides PostgreSQL object fields support for yii2 models.

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

[](#installation)

Add a dependency to your project's composer.json:

```
{
	"require": {
		"fgh151/yii2-postgresql-array-field": "*"
	}
}
```

Upgrade from 1.\* to 2.\*
-------------------------

[](#upgrade-from-1-to-2)

breaking changes

- min php version 8.2
- fgh151\\PostgresqlJsonb\\models\\DynamicModel is deprecated, and was deleted.
- fgh151\\PostgresqlJsonb\\PostgresqlJsonbFieldBehavior::postgresqlJsonDecode now return array
- use value as array, instead of object (see example below)

Db migration example
--------------------

[](#db-migration-example)

```
$this->createTable('UserReward', [
    'jsonField' => fgh151\PostgresqlJsonb\db\Schema::TYPE_JSONB
]);
```

Usage example
-------------

[](#usage-example)

#### Attach behavior to one or more fields of your model

[](#attach-behavior-to-one-or-more-fields-of-your-model)

```
use yii\db\ActiveRecord;
use \fgh151\PostgresqlJsonb\PostgresqlJsonbFieldBehavior;

/**
 * @property array $modelField
 */
class Model extends ActiveRecord{
	public function behaviors() {
		return [
			[
				'class' => PostgresqlJsonbFieldBehavior::className(),
				'arrayFieldName' => 'modelField', // model's field to attach behavior
				'onEmptySaveNull' => true // if set to false, empty array will be saved as empty PostreSQL array '{}' (default: true)
			]
		];
	}
}
```

```
$model->jsonField['property'] = 'value';
$model->jsonField['otherProperty']['otherPropertyValue'] = 'another value';
```

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance88

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

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

Total

2

Last Release

59d ago

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

v0.0.2PHP &gt;=8.2.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/645524?v=4)[Fedor Gorsky](/maintainers/fgh151)[@fgh151](https://github.com/fgh151)

---

Top Contributors

[![fgh151](https://avatars.githubusercontent.com/u/645524?v=4)](https://github.com/fgh151 "fgh151 (7 commits)")

### Embed Badge

![Health badge](/badges/fgh151-yii2-postgresql-array-field/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.7M3.4k](/packages/craftcms-cms)[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13926.0k65](/packages/skeeks-cms)[bizley/migration

Migration generator for Yii 2.

291393.8k11](/packages/bizley-migration)[yii2tech/illuminate

Yii2 to Laravel Migration Package

11516.5k](/packages/yii2tech-illuminate)[mootensai/yii2-relation-trait

Yii 2 Models load with relation, &amp; transaction save with relation

49238.0k9](/packages/mootensai-yii2-relation-trait)

PHPackages © 2026

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