PHPackages                             lubos/expandable - 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. lubos/expandable

AbandonedArchivedCakephp-plugin

lubos/expandable
================

CakePHP Expandable plugin

1.0.3(12y ago)84.4k↓100%10[1 PRs](https://github.com/LubosRemplik/CakePHP-Expandable-Plugin/pulls)PHPPHP &gt;=5.2.8

Since Mar 21Pushed 6y ago2 watchersCompare

[ Source](https://github.com/LubosRemplik/CakePHP-Expandable-Plugin)[ Packagist](https://packagist.org/packages/lubos/expandable)[ RSS](/packages/lubos-expandable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

CakePHP Expandable Plugin
=========================

[](#cakephp-expandable-plugin)

Makes possible to save different fields for each item in two tables without touching schema.

It works like Cake's i18n table

Instalation:
------------

[](#instalation)

Via git clone into your plugin folder or use [composer](https://getcomposer.org/doc/00-intro.md). For existing applications you can add the following to your `composer.json` file:

```
"require": {
	"lubos/expandable": "~1.0"
}

```

And run `php composer.phar update`

What it Does:
-------------

[](#what-it-does)

The ExpandableBehavior will allow you to extend any model with any set of "extra fields" which don't exist in it's schema.

It uses a second table/model as a the key/value table, which links back to the primary table/model. Thus you can store any details you want separate from the main table/model, keeping schema simpler and reducing (main) table size.

Setup:
------

[](#setup)

```
git clone git://github.com/LubosRemplik/CakePHP-Expandable-Plugin.git app/Plugin/Expandable

```

You must make a new Table to store the keys/values and optionally a Model for that table. It should be named something like 'my\_model\_expands', and it needs the following fields:

- a primary ID
- a foreignKey linking back to the primary table
- a "key" field
- a "value" field \*\* null if you want to get null back, varchar or text depending on what you want to store

In your schema:
---------------

[](#in-your-schema)

```
	public $my_model_expands = array(
		'id' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 36, 'key' => 'primary', 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
		'my_model_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'key' => 'index'),
		'created' => array('type' => 'datetime', 'null' => true, 'default' => null),
		'key' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 128, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
		'value' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'),
		'indexes' => array(
			'PRIMARY' => array('column' => 'id', 'unique' => 1),
			'search' => array('column' => array('account_id', 'key'), 'unique' => 1)
		),
		'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB')
	);

```

And you can create the table via the shell:

```
./cake schema create
n
y

```

On MyModel:
-----------

[](#on-mymodel)

Setup the Expandable Behavior, configure "with" the Expand Model, and ensure you put the Expand model into the "hasMany" array.

```
	public $actsAs = array(
		'Expandable.Expandable' => array(
			'with' => 'MyModelExpand',
		)
	);
	public $hasMany = array('MyModelExpand');

```

Usage:
------

[](#usage)

Just do normal `save()` on the model, and a normal `find()` (containing the Expand data).

Your extra fields, not in the schema, will show up... add as many as you like.

For more information on this functionality, and a plain example of functionality, check out the packaged unit tests

```
./cake test Expandable Model/Behavior/ExpandableBehavior

```

Credits:
--------

[](#credits)

Primary source:

- @link
- @link
- @link

Repackaged:

- @link

Updated:

- @link

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 70% 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 ~15 days

Total

4

Last Release

4386d ago

### Community

Maintainers

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

---

Top Contributors

[![zeroasterisk](https://avatars.githubusercontent.com/u/23422?v=4)](https://github.com/zeroasterisk "zeroasterisk (7 commits)")[![chrisjohnson](https://avatars.githubusercontent.com/u/178144?v=4)](https://github.com/chrisjohnson "chrisjohnson (2 commits)")[![webtechnick](https://avatars.githubusercontent.com/u/26438?v=4)](https://github.com/webtechnick "webtechnick (1 commits)")

### Embed Badge

![Health badge](/badges/lubos-expandable/health.svg)

```
[![Health](https://phpackages.com/badges/lubos-expandable/health.svg)](https://phpackages.com/packages/lubos-expandable)
```

###  Alternatives

[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k4](/packages/elgg-elgg)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)[johnbillion/user-switching

Instant switching between user accounts in WordPress and WooCommerce.

19768.3k2](/packages/johnbillion-user-switching)[rainlab/blog-plugin

Blog plugin for October CMS

17257.7k](/packages/rainlab-blog-plugin)[starcitizentools/citizen-skin

A beautiful, usable, responsive MediaWiki skin with in-depth extension support. Originally developed for the Star Citizen Wiki.

3164.5k](/packages/starcitizentools-citizen-skin)[proloser/cakephp-csv

5223.6k](/packages/proloser-cakephp-csv)

PHPackages © 2026

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