PHPackages                             openbuildings/jam-freezable - 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. openbuildings/jam-freezable

ActiveKohana-module[Database &amp; ORM](/categories/database)

openbuildings/jam-freezable
===========================

Freeze dynamically computed values in the database using Jam

0.1.3(12y ago)03.0kBSD-3-ClausePHPPHP &gt;=5.3.0

Since Nov 13Pushed 12y ago14 watchersCompare

[ Source](https://github.com/OpenBuildings/jam-freezable)[ Packagist](https://packagist.org/packages/openbuildings/jam-freezable)[ Docs](https://github.com/OpenBuildings/jam-freezable)[ RSS](/packages/openbuildings-jam-freezable/feed)WikiDiscussions master Synced 2mo ago

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

Freezable Behavior
==================

[](#freezable-behavior)

[![Build Status](https://camo.githubusercontent.com/7b07e951c18a58b9ab8fc90e2256b76068358e5ed89f08e3140c3bed758c6da0/68747470733a2f2f7472617669732d63692e6f72672f4f70656e4275696c64696e67732f6a616d2d667265657a61626c652e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/OpenBuildings/jam-freezable)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/7a617acc6288f3cc295aeaaba3f5b522838b08f722e1d114744f0d23c8a79cbf/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4f70656e4275696c64696e67732f6a616d2d667265657a61626c652f6261646765732f7175616c6974792d73636f72652e706e673f733d61313861373135356564653365613637303938383939376339336262353061366438623939333136)](https://scrutinizer-ci.com/g/OpenBuildings/jam-freezable/)[![Code Coverage](https://camo.githubusercontent.com/36cd6b01a36bb53df115918a8cfb55af6ab943917859624fd9bd5da1b356589d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4f70656e4275696c64696e67732f6a616d2d667265657a61626c652f6261646765732f636f7665726167652e706e673f733d63626664613533343464666236326165366336373039386233316332373762343561663163353031)](https://scrutinizer-ci.com/g/OpenBuildings/jam-freezable/)[![Latest Stable Version](https://camo.githubusercontent.com/96b7d8739dd3afc410360b3fb79abcf9aa92f307e5cb1845d943fefe396301c3/68747470733a2f2f706f7365722e707567782e6f72672f6f70656e6275696c64696e67732f6a616d2d667265657a61626c652f762f737461626c652e706e67)](https://packagist.org/packages/openbuildings/jam-freezable)

**Freezable** is a [Jam ORM](https://github.com/OpenBuildings/jam) behavior for freezing dynamically computed values in the database.

---

Often one would have a method in the model which computes and returns a value. It could be a price, time or anything else. The computation could be a heavy one or time sensitive (based on time, currency exchange rates and other). Then you would need to save the value in a database column (a.k.a *freezing*) and in the future read the value from the field rather than the method.

The Freezable behavior allows you to do exactly that in an easy way. The `freeze()`, `unfreeze()` and `is_frozen()` methos give you the convenience to easily get either the dynamically computed or the frozen value when needed.

Usage
-----

[](#usage)

It has 3 parameters `associations`, `parent` and `fields`

```
class Some_Model extends Jam_Model {

	public static function initialize(Jam_Meta $meta)
	{
		$meta
			->behaviors(array(
				'freezable' => Jam::behavior('freezable', array(
					'fields' => 'price',
					'parent' => 'some_parent_model',
					'associations' => array('some_child', 'some_children'),
				)),
			));
	}
	//...
}
```

That means that whenever the model is *frozen* then the field named `price` will be assigned the value of the method `price()`. And all the associations will be also *frozen*. The associations themselves have to be *freezable* (have the Freezable behavior attached) in order for this to work. And the `price()` method, as well as any other fields, have to take into account the value of the field. E.g.

```
public function price()
{
	return $this->price ? $this->price : $this->compute_price();
}
```

The parent association is used in order to find the value of `is_frozen`, so that only one model holds the value of the flag. So that if you call `is_frozen()` on a *freezable* that has a *parent*, then it will get that value from the parent.

Details
-------

[](#details)

TODO: add note about validation TODO: add more examples

License
-------

[](#license)

Copyright (c) 2013 OpenBuildings, Inc. Developed by Ivan Kerin as part of [clippings.com](https://clippings.com).

Under BSD-3-Clause license, read [LICENSE](LICENSE) file.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 68.4% 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 ~36 days

Total

4

Last Release

4452d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/506129?v=4)[Harry Dobrev](/maintainers/hkdobrev)[@hkdobrev](https://github.com/hkdobrev)

![](https://avatars.githubusercontent.com/u/4113307?v=4)[Danail Kyosev](/maintainers/dkyosev)[@dkyosev](https://github.com/dkyosev)

![](https://avatars.githubusercontent.com/u/7592650?v=4)[Evstati Zarkov](/maintainers/EZarkov)[@EZarkov](https://github.com/EZarkov)

![](https://avatars.githubusercontent.com/u/745771?v=4)[Filip Georgiev](/maintainers/phgeorgiev)[@phgeorgiev](https://github.com/phgeorgiev)

![](https://avatars.githubusercontent.com/u/490439?v=4)[Zdravko Evstatiev](/maintainers/zedevs)[@zedevs](https://github.com/zedevs)

---

Top Contributors

[![hkdobrev](https://avatars.githubusercontent.com/u/506129?v=4)](https://github.com/hkdobrev "hkdobrev (13 commits)")[![ivank](https://avatars.githubusercontent.com/u/4976?v=4)](https://github.com/ivank "ivank (6 commits)")

---

Tags

databasejamfreezing

### Embed Badge

![Health badge](/badges/openbuildings-jam-freezable/health.svg)

```
[![Health](https://phpackages.com/badges/openbuildings-jam-freezable/health.svg)](https://phpackages.com/packages/openbuildings-jam-freezable)
```

###  Alternatives

[openbuildings/jam

Small but feature rich ORM, has extensible models and builders, baked in upload functionality, supporting multiple backends (rackspace, ftp), polymorphic associations, form builders, nested forms, validators

32181.3k16](/packages/openbuildings-jam)[olliejones/index-wp-mysql-for-speed

Speed up your WordPress site by adding high-performance keys (database indexes) to your MySQL database tables.

1481.8k](/packages/olliejones-index-wp-mysql-for-speed)[devgeniem/better-wp-db-error

Better WordPress database error handling.

1161.3k](/packages/devgeniem-better-wp-db-error)[pixelstudio/wp-sync-db

WordPress plugin to sync database between different installs

462.5k1](/packages/pixelstudio-wp-sync-db)

PHPackages © 2026

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