{"id":17443445,"url":"https://github.com/formal-php/orm","last_synced_at":"2026-02-27T19:27:45.349Z","repository":{"id":181246743,"uuid":"356596901","full_name":"formal-php/orm","owner":"formal-php","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-26T09:48:53.000Z","size":2606,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2024-07-31T09:21:18.095Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://formal-php.github.io/orm/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/formal-php.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-10T13:55:50.000Z","updated_at":"2024-08-01T13:01:21.518Z","dependencies_parsed_at":"2024-05-29T17:27:21.941Z","dependency_job_id":"4166b3e9-825d-4e45-83ca-527fb7a7ed4f","html_url":"https://github.com/formal-php/orm","commit_stats":null,"previous_names":["formal-php/orm"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formal-php%2Form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formal-php%2Form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formal-php%2Form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/formal-php%2Form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/formal-php","download_url":"https://codeload.github.com/formal-php/orm/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241421085,"owners_count":19960221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-17T17:00:49.271Z","updated_at":"2025-12-27T08:09:17.570Z","avatar_url":"https://github.com/formal-php.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# ORM\n\n[![Build Status](https://github.com/formal-php/orm/workflows/CI/badge.svg?branch=master)](https://github.com/formal-php/orm/actions?query=workflow%3ACI)\n[![codecov](https://codecov.io/gh/formal-php/orm/branch/develop/graph/badge.svg)](https://codecov.io/gh/formal-php/orm)\n[![Type Coverage](https://shepherd.dev/github/formal-php/orm/coverage.svg)](https://shepherd.dev/github/formal-php/orm)\n\nThis ORM[^1] focuses to simplify data manipulation.\n\nThis is achieved by:\n\n- using immutable objects\n- each aggregate _owning_ the objects it references\n- using monads to fetch aggregates (from the [Innmind](https://github.com/Innmind) ecosystem)\n- using the specification pattern to match aggregates\n\nThis allows:\n\n- simpler app design (as it can be [pure](https://innmind.github.io/documentation/philosophy/oop-fp/#purity))\n- memory efficiency (the ORM doesn't keep objects in memory)\n- long living processes (since there is no memory leaks)\n- to work asynchronously\n\n## Installation\n\n```sh\ncomposer require formal/orm\n```\n\n## Usage\n\n```php\nuse Formal\\ORM\\{\n    Manager,\n    Sort,\n};\nuse Formal\\AccessLayer\\Connection\\PDO;\nuse Innmind\\Url\\Url;\n\n$manager = Manager::sql(\n    PDO::of(Url::of('mysql://user:pwd@host:3306/database?charset=utf8mb4')),\n);\n$_ = $manager\n    -\u003erepository(YourAggregate::class)\n    -\u003eall()\n    -\u003esort('someProperty', Sort::asc)\n    -\u003edrop(150)\n    -\u003etake(50)\n    -\u003eforeach(static fn($aggregate) =\u003e doStuff($aggregate));\n```\n\nThis 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.\n\n\u003e [!NOTE]\n\u003e 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.\n\n## Documentation\n\nFull documentation available [here](https://formal-php.github.io/orm/).\n\n[^1]: Object Relational Mapping\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fformal-php%2Form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fformal-php%2Form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fformal-php%2Form/lists"}