PHPackages                             fucoso/orm - 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. fucoso/orm

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

fucoso/orm
==========

ORM for projects where Doctrine is not an option.

061PHP

Since Mar 5Pushed 11y ago1 watchersCompare

[ Source](https://github.com/fucoso/orm)[ Packagist](https://packagist.org/packages/fucoso/orm)[ RSS](/packages/fucoso-orm/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

ORM
===

[](#orm)

ORM for those project where Doctrine can't be used.

Warning: This is a work in progress.

Intended Features
-----------------

[](#intended-features)

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

Quick Overview
--------------

[](#quick-overview)

```
// Create a new person record
$person = new Person();
$person->name = "Frank Zappa";
$person->birthday = "1940-12-20";
$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
Trade::get('2013-01-01', 100);
Trade::find('2013-01-01', 100);
Trade::exists('2013-01-01', 100);

// Primary keys can also be given as arrays
$tradePK = array('2013-01-01', 100);
Trade::get($tradePK);
Trade::find($tradePK);
Trade::exists($tradePK);

// 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();

// 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 queries
$conn = DB::getConnection('myconn');
$data1 = $conn->query("SELECT * FROM mytable;");
$data2 = $conn->preparedQuery("SELECT * FROM mytable WHERE mycol > :value", array("value" => 10))
```

Inspirations:

- [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/)
- [Phormium](https://github.com/ihabunek/phormium)

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/61873cc2e3e5331e13c2dc80f5c32d774da81f1b07fc735df9ff3cde26c6cc5d?d=identicon)[syedhaiderabbas](/maintainers/syedhaiderabbas)

---

Top Contributors

[![syed-haider-abbas](https://avatars.githubusercontent.com/u/1918621?v=4)](https://github.com/syed-haider-abbas "syed-haider-abbas (7 commits)")

### Embed Badge

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

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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