PHPackages                             cakebake/yii2-scalable-behavior - 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. cakebake/yii2-scalable-behavior

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

cakebake/yii2-scalable-behavior
===============================

Key-Value storage is a very simplistic, but very powerful model. Use this behavior to expand your Yii 2 model without changing the structure.

1.0.0-beta(11y ago)41053LGPL-V3PHP

Since Sep 8Pushed 11y ago1 watchersCompare

[ Source](https://github.com/cakebake/yii2-scalable-behavior)[ Packagist](https://packagist.org/packages/cakebake/yii2-scalable-behavior)[ RSS](/packages/cakebake-yii2-scalable-behavior/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Scalable Database Schema
========================

[](#scalable-database-schema)

Key-Value storage is a very simplistic, but very powerful model. Use this behavior to expand your Yii 2 model without changing the structure.

Data can be queried and saved with "virtual attributes". These are stored serialized in a configured table column.

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist cakebake/yii2-scalable-behavior "*"

```

or add

```
"cakebake/yii2-scalable-behavior": "*"

```

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

Preparation
-----------

[](#preparation)

Create a column in your desired table. It is recommended to use the type "text" or "longtext" in order to save as much data as possible.

Usage
-----

[](#usage)

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

```
    use cakebake\behaviors\ScalableBehavior;

    public function behaviors()
    {
        return [
            ...
            'scaleable' => [
                'class' => ScalableBehavior::className(),
                'scalableAttribute' => 'value', // The owner object's attribute / the column of the corresponding table, which are used as storage for the virtual attributes
                'virtualAttributes' => ['about_me', 'birthday'] // Definition of virtual attributes that are added to the owner object
            ],
            ...
        ];
    }
```

Now we can proceed similarly with the virtual attributes like normal.

```
    public function rules()
    {
        return [
            ['about_me', 'required'],
            ['about_me', 'string'],
            ['birthday', 'string', 'max' => 60],
        ];
    }
```

Piece of advice
---------------

[](#piece-of-advice)

This technique should be used only for metadata. Improper use may change the application performance negatively.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

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

Unknown

Total

1

Last Release

4263d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3f0c610f1daae44aca882e9f8319422fc19d8fc9fa727051c005722c6eb8e5fe?d=identicon)[cakebake](/maintainers/cakebake)

---

Top Contributors

[![cakebake](https://avatars.githubusercontent.com/u/7462226?v=4)](https://github.com/cakebake "cakebake (10 commits)")

---

Tags

schemaconvertdatadatabaseserializemysqldbattributesyii2extensionBehavioractiverecorddynamicscalablevirtualunserialize

### Embed Badge

![Health badge](/badges/cakebake-yii2-scalable-behavior/health.svg)

```
[![Health](https://phpackages.com/badges/cakebake-yii2-scalable-behavior/health.svg)](https://phpackages.com/packages/cakebake-yii2-scalable-behavior)
```

###  Alternatives

[sjaakp/yii2-spatial

Yii2 ActiveRecord supporting MySQL spatial data

1873.8k1](/packages/sjaakp-yii2-spatial)[aura/sqlschema

Provides facilities to read table names and table columns from a database using PDO.

41234.1k4](/packages/aura-sqlschema)[dmstr/yii2-db

Database extensions

19618.8k6](/packages/dmstr-yii2-db)[mg-code/yii2-helpers

A collection of useful helper classes for Yii framework 2.0

2022.5k5](/packages/mg-code-yii2-helpers)[smrtr/mysql-version-control

A crude version control system for mysql written in php

221.4k](/packages/smrtr-mysql-version-control)

PHPackages © 2026

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