PHPackages                             yiisoft-custom/yii2-model-attribute-convert - 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. yiisoft-custom/yii2-model-attribute-convert

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

yiisoft-custom/yii2-model-attribute-convert
===========================================

Base on Yii2 BaseActiveRecord. Converts column from db format to model format while SELECT,oppositely way while INSERT or UPDATE

v1.2(3y ago)058MITPHPPHP &gt;=7.0

Since Nov 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/MrYup/yii2-attributes-convert)[ Packagist](https://packagist.org/packages/yiisoft-custom/yii2-model-attribute-convert)[ RSS](/packages/yiisoft-custom-yii2-model-attribute-convert/feed)WikiDiscussions master Synced today

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

Soft delete
===========

[](#soft-delete)

Attribute value converted between db format and Yii2 model format

Require yiisoft/yii2

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

[](#installation)

```
composer require yiisoft-custom/yii2-model-attribute-convert
```

Notice &amp; Important
======================

[](#notice--important)

Case the attribute set an converter in cast,it would be converted to model format while trigger `EVENT_AFTER_FIND`, and the model value strictly is already changed (e.g: db value format is json `[1,2,3]`,with 'Array' converter , model format would be`array(1,2,3)`). the result of these method calls would be effected :

```
isAttributeChanged(),
getOldAttribute(),
getOldAttributes(),
getDirtyAttributes()

```

But don't worry,we gotta the suitable calls instead while any attribute of model casted with a converter,list of mapper:

```
isAttributeChangedWithConverter()   -> isAttributeChanged()
getOldAttributeWithConverter()      -> getOldAttribute()
getOldAttributesWithConverter()     -> getOldAttributes()
getDirtyAttributesWithConverter()   -> getDirtyAttributes()

```

Usage
=====

[](#usage)

```

```

Just used like other behavior class. Property `$cast` is key-value(eg: `'order_no' => 'Array'`). `Key` is the attribute needs to be converted,and `value` is the converter,class name or string maps a class name would be fine

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Total

4

Last Release

1282d ago

PHP version history (2 changes)v1.0PHP &gt;=5.4

v1.0.1PHP &gt;=7.0

### Community

Maintainers

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

---

Top Contributors

[![Heatstorm](https://avatars.githubusercontent.com/u/101440826?v=4)](https://github.com/Heatstorm "Heatstorm (2 commits)")

---

Tags

yii2 attributes converts

### Embed Badge

![Health badge](/badges/yiisoft-custom-yii2-model-attribute-convert/health.svg)

```
[![Health](https://phpackages.com/badges/yiisoft-custom-yii2-model-attribute-convert/health.svg)](https://phpackages.com/packages/yiisoft-custom-yii2-model-attribute-convert)
```

###  Alternatives

[yii2tech/illuminate

Yii2 to Laravel Migration Package

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

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

47220.3k9](/packages/mootensai-yii2-relation-trait)[nhkey/yii2-activerecord-history

Storage history of changes to ActiveRecord

46143.4k1](/packages/nhkey-yii2-activerecord-history)[dmstr/yii2-db

Database extensions

19618.8k6](/packages/dmstr-yii2-db)[urbanindo/yii2-dynamodb

DynamoDB extensions for Yii2

1471.4k](/packages/urbanindo-yii2-dynamodb)[spanjeta/yii2-backup

Database Backup and Restore functionality

285.0k1](/packages/spanjeta-yii2-backup)

PHPackages © 2026

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