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

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

formal/orm
==========

6.0.0(4mo ago)324.7k↑48.2%1MITPHPPHP ~8.2CI passing

Since Aug 15Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/formal-php/orm)[ Packagist](https://packagist.org/packages/formal/orm)[ Docs](http://github.com/formal/orm)[ RSS](/packages/formal-orm/feed)WikiDiscussions develop Synced yesterday

READMEChangelog (10)Dependencies (16)Versions (26)Used By (1)

ORM
===

[](#orm)

[![Build Status](https://github.com/formal-php/orm/workflows/CI/badge.svg?branch=master)](https://github.com/formal-php/orm/actions?query=workflow%3ACI)[![codecov](https://camo.githubusercontent.com/4f29f7248c84b1115d931eee9f0012a20a493d72582f6b742eb07f7650094a17/68747470733a2f2f636f6465636f762e696f2f67682f666f726d616c2d7068702f6f726d2f6272616e63682f646576656c6f702f67726170682f62616467652e737667)](https://codecov.io/gh/formal-php/orm)[![Type Coverage](https://camo.githubusercontent.com/6ac2750b64afcaaed5cf7f05ac305acf6913f903fa1bf17eb5adbe06b383eaf5/68747470733a2f2f73686570686572642e6465762f6769746875622f666f726d616c2d7068702f6f726d2f636f7665726167652e737667)](https://shepherd.dev/github/formal-php/orm)

This ORM[1](#user-content-fn-1-2941d65377fd6aebab14f8424e03c1df) focuses to simplify data manipulation.

This is achieved by:

- using immutable objects
- each aggregate *owning* the objects it references
- using monads to fetch aggregates (from the [Innmind](https://github.com/Innmind) ecosystem)
- using the specification pattern to match aggregates

This allows:

- simpler app design (as it can be [pure](https://innmind.github.io/documentation/philosophy/oop-fp/#purity))
- memory efficiency (the ORM doesn't keep objects in memory)
- long living processes (since there is no memory leaks)
- to work asynchronously

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

[](#installation)

```
composer require formal/orm
```

Usage
-----

[](#usage)

```
use Formal\ORM\{
    Manager,
    Sort,
};
use Formal\AccessLayer\Connection\PDO;
use Innmind\Url\Url;

$manager = Manager::sql(
    PDO::of(Url::of('mysql://user:pwd@host:3306/database?charset=utf8mb4')),
);
$_ = $manager
    ->repository(YourAggregate::class)
    ->all()
    ->sort('someProperty', Sort::asc)
    ->drop(150)
    ->take(50)
    ->foreach(static fn($aggregate) => doStuff($aggregate));
```

This simple example will retrieve from the database `50` elements (from index `151` to `200`) sorted by `someProperty` in ascending order and will call the function `doStuff` on each aggregate.

Note

The elements are streamed meaning only one aggregate is in memory at a time allowing you to deal with long lists of elements in a memory safe way.

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

[](#documentation)

Full documentation available [here](https://formal-php.github.io/orm/).

Footnotes
---------

1. Object Relational Mapping [↩](#user-content-fnref-1-2941d65377fd6aebab14f8424e03c1df)

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance81

Actively maintained with recent releases

Popularity31

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 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

Every ~44 days

Recently: every ~75 days

Total

22

Last Release

126d ago

Major Versions

1.2.0 → 2.0.02024-02-25

2.2.0 → 3.0.02024-07-14

3.4.1 → 4.0.02024-10-31

4.1.1 → 5.0.02025-06-04

5.1.1 → 6.0.02026-02-27

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/851425?v=4)[Baptiste Langlade](/maintainers/Baptouuuu)[@Baptouuuu](https://github.com/Baptouuuu)

---

Top Contributors

[![Baptouuuu](https://avatars.githubusercontent.com/u/851425?v=4)](https://github.com/Baptouuuu "Baptouuuu (621 commits)")

### Embed Badge

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

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

###  Alternatives

[bavix/laravel-wallet

It's easy to work with a virtual wallet.

1.3k1.3M19](/packages/bavix-laravel-wallet)[leantime/leantime

Open source project management system for non-project managers. Simple like Trello, powerful like Jira. Built with neurodiversity in mind.

10.2k3.5k](/packages/leantime-leantime)[google/cloud-bigquery

BigQuery Client for PHP

8919.2M53](/packages/google-cloud-bigquery)[patchlevel/event-sourcing

A lightweight but also all-inclusive event sourcing library with a focus on developer experience

207362.9k13](/packages/patchlevel-event-sourcing)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[markocupic/calendar-event-booking-bundle

Contao Calendar Event Booking Bundle

135.2k1](/packages/markocupic-calendar-event-booking-bundle)

PHPackages © 2026

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