Skip to content

ORM

This ORM focuses on simplifying data manipulation.

It can handle any amount of data by being memory safe and reduces the complexity of data lifecycle by using immutable objects.

Info

Its monadic design allows it to be compatible with Innmind's asynchronous context.

Installation

composer require formal/orm:~3.0

Example

use Formal\ORM\{
    Manager,
    Sort,
};
use Innmind\Url\Url;

$manager = Manager::sql(
    $os
        ->remote()
        ->sql(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(YourAggregate $aggregate) => doStuff($aggregate));

Tips

Since it focuses on usage and not abstracting a persistence model this ORM allows 3 different persistence models:

  • SQL
  • Filesystem
  • Elasticsearch

Advanced usage

Full documentation available here.