PHPackages                             phormium/phormium - 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. phormium/phormium

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

phormium/phormium
=================

A minimalist ORM for PHP.

0.8.0(10y ago)5519.2k↓100%8MITPHPPHP &gt;=5.4.0

Since Apr 25Pushed 3y ago5 watchersCompare

[ Source](https://github.com/ihabunek/phormium)[ Packagist](https://packagist.org/packages/phormium/phormium)[ Docs](https://github.com/ihabunek/phormium)[ RSS](/packages/phormium-phormium/feed)WikiDiscussions develop Synced today

READMEChangelog (10)Dependencies (3)Versions (17)Used By (0)

Phormium
========

[](#phormium)

Phormium is a minimalist ORM for PHP.

Tested on Informix, MySQL, PosgreSQL and SQLite. Might work on other databases with a PDO driver or may require some work.

---

**This project is no longer maintained and the repository is archived. Thanks for all the fish.**

---

[![Latest Stable Version](https://camo.githubusercontent.com/ffacc5db01a15b3b6b8a129cd417c9d3e6b124444eaf35203a859af5872e055e/68747470733a2f2f706f7365722e707567782e6f72672f70686f726d69756d2f70686f726d69756d2f762f737461626c652e706e67)](https://packagist.org/packages/phormium/phormium) [![Total Downloads](https://camo.githubusercontent.com/c4ac445357661d68be367d6ce93a4023913e7f1fa2f38b0f7f4ac1e5b98944dd/68747470733a2f2f706f7365722e707567782e6f72672f70686f726d69756d2f70686f726d69756d2f646f776e6c6f6164732e706e67)](https://packagist.org/packages/phormium/phormium) [![Build Status](https://camo.githubusercontent.com/fc1167f5ae875c90763fa8f0466ce59b780d3b6527d52ac95807ff344e4614ec/68747470733a2f2f7472617669732d63692e6f72672f69686162756e656b2f70686f726d69756d2e706e67)](https://travis-ci.org/ihabunek/phormium) [![Coverage Status](https://camo.githubusercontent.com/8bf274d63499ea15b1464e9b51c1eaa3a649f49d8036ccbb8bdea0a1ed3351f6/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f69686162756e656b2f70686f726d69756d2f62616467652e706e67)](https://coveralls.io/r/ihabunek/phormium)

Features
--------

[](#features)

- CRUD operations made simple
- batch update and delete
- filtering
- ordering
- limiting
- transactions
- custom queries
- events

Documentation
-------------

[](#documentation)

[The documentation](http://phormium.readthedocs.org/en/latest/) is hosted by ReadTheDocs.org.

Showcase
--------

[](#showcase)

After initial setup, Phormium is very easy to use. Here's a quick overview of it's features:

```
// Create a new person record
$person = new Person();
$person->name = "Frank Zappa";
$person->birthday = "1940-12-21";
$person->save();

// Get record by primary key
Person::get(10);   // Throws exception if the model doesn't exist
Person::find(10);  // Returns null if the model doesn't exist

// Check record exists by primary key
Person::exists(10);

// Also works for composite primary keys
Post::get('2013-01-01', 100);
Post::find('2013-01-01', 100);
Post::exists('2013-01-01', 100);

// Primary keys can also be given as arrays
Post::get(['2013-01-01', 100]);
Post::find(['2013-01-01', 100]);
Post::exists(['2013-01-01', 100]);

// Fetch, update, save
$person = Person::get(10);
$person->salary += 5000; // give the man a raise!
$person->save();

// Fetch, delete
Person::get(37)->delete();

// Intuitive filtering, ordering and limiting
$persons = Person::objects()
    ->filter('salary', '>', 10000)
    ->filter('birthday', 'between', ['2000-01-01', '2001-01-01'])
    ->orderBy('name', 'desc')
    ->limit(100)
    ->fetch();

// Count records
$count = Person::objects()
    ->filter('salary', '>', 10000)
    ->count();

// Check if any records matching criteria exist
$count = Person::objects()
    ->filter('salary', '>', 10000)
    ->exists();

// Distinct values
$count = Person::objects()
    ->distinct('name', 'email');

// Complex composite filters
$persons = Person::objects()->filter(
    Filter::_or(
        Filter::_and(
            array('id', '>=', 10),
            array('id', '=', 50),
            array('id', '=', 100),
    )
)->fetch();

// Fetch a single record (otherwise throws an exeption)
$person = Person::objects()
    ->filter('email', '=', 'ivan@example.com')
    ->single();

// Batch update
Person::objects()
    ->filter('salary', '>', 10000)
    ->update(['salary' => 5000]);

// Batch delete
Person::objects()
    ->filter('salary', '>', 10000)
    ->delete();

// Aggregates
Person::objects()->filter('name', 'like', 'Ivan%')->avg('salary');
Person::objects()->filter('name', 'like', 'Marko%')->min('birthday');

// Custom filters with argument binding
Person::objects()
    ->filter("my_func(salary) > ?", [100])
    ->fetch();
```

See [documentation](http://phormium.readthedocs.org/en/latest/) for full reference, also check out the `example` directory for more examples.

Why?
----

[](#why)

"Why another ORM?!?", I hear you cry.

There are two reasons:

- I work a lot on Informix on my day job and no other ORM I found supports it.
- Writing an ORM is a great experience. You should try it.

Phormium is greatly inspired by other ORMs, in particular:

- [Django ORM](https://docs.djangoproject.com/en/dev/topics/db/)
- Laravel's [Eloquent ORM](http://laravel.com/docs/database/eloquent)
- [Paris](http://j4mie.github.io/idiormandparis/)

Let me know what you think!

Ivan Habunek [@ihabunek](http://twitter.com/ihabunek)

Praise
------

[](#praise)

If you like it, buy me a beer (in Croatia, that's around €2 or $3).

[![Flattr this](https://camo.githubusercontent.com/7e3f46a36526479d701ef7f90a0f8c3ac2fbab3087446e2a9fceed75cd1ab802/687474703a2f2f6170692e666c617474722e636f6d2f627574746f6e2f666c617474722d62616467652d6c617267652e706e67)](http://flattr.com/thing/1204532/ihabunekphormium-on-GitHub)

License
-------

[](#license)

Licensed under the MIT license. `See LICENSE.md`.

###  Health Score

35

—

LowBetter than 81% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity37

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.7% 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 ~82 days

Recently: every ~98 days

Total

10

Last Release

3971d ago

PHP version history (2 changes)0.1PHP &gt;=5.3.0

0.7.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/69d0973e79ec870cb60522b5785e3e78e17d4b3569dde896d693b01a381c6f59?d=identicon)[ihabunek](/maintainers/ihabunek)

---

Top Contributors

[![ihabunek](https://avatars.githubusercontent.com/u/482138?v=4)](https://github.com/ihabunek "ihabunek (390 commits)")[![grobmeier](https://avatars.githubusercontent.com/u/873786?v=4)](https://github.com/grobmeier "grobmeier (5 commits)")

---

Tags

phpdatabaseormmapping

### Embed Badge

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

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

###  Alternatives

[bauer01/unimapper

Universal mapping tool for collecting data from different sources

112.6k6](/packages/bauer01-unimapper)[modul-is/orm

Lightweight hybrid ORM/Explorer

1117.8k](/packages/modul-is-orm)[proesio/pipe

PIPE - ORM en Español.

129.1k1](/packages/proesio-pipe)[perplorm/perpl

Perpl is an improved and still maintained fork of Propel2, an open-source Object-Relational Mapping (ORM) for PHP.

161.9k](/packages/perplorm-perpl)[riverside/php-orm

PHP ORM micro-library and query builder

121.2k](/packages/riverside-php-orm)[bauer01/unimapper-flexibee

Flexibee implementation for UniMapper

101.1k](/packages/bauer01-unimapper-flexibee)

PHPackages © 2026

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