{"id":13579243,"url":"https://github.com/cycle/orm","last_synced_at":"2025-05-13T19:04:07.768Z","repository":{"id":37549650,"uuid":"156524861","full_name":"cycle/orm","owner":"cycle","description":"PHP DataMapper, ORM","archived":false,"fork":false,"pushed_at":"2025-04-04T20:59:43.000Z","size":4236,"stargazers_count":1247,"open_issues_count":84,"forks_count":74,"subscribers_count":27,"default_branch":"2.x","last_synced_at":"2025-04-28T00:34:34.278Z","etag":null,"topics":["cycle","datamapper","hacktoberfest","mapper","orm","php","query-builder"],"latest_commit_sha":null,"homepage":"https://cycle-orm.dev","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/cycle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null},"funding":{"github":"cycle"}},"created_at":"2018-11-07T09:50:20.000Z","updated_at":"2025-04-16T04:47:28.000Z","dependencies_parsed_at":"2024-03-29T15:30:17.602Z","dependency_job_id":"40e2b728-1c49-4b91-87e6-732b116cf405","html_url":"https://github.com/cycle/orm","commit_stats":{"total_commits":1185,"total_committers":29,"mean_commits":40.86206896551724,"dds":"0.18312236286919836","last_synced_commit":"7c142c0ebfdf954931bfbaa2cf08f53c486ce7bb"},"previous_names":[],"tags_count":98,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cycle%2Form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cycle","download_url":"https://codeload.github.com/cycle/orm/tar.gz/refs/heads/2.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254010796,"owners_count":21998993,"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":["cycle","datamapper","hacktoberfest","mapper","orm","php","query-builder"],"created_at":"2024-08-01T15:01:37.659Z","updated_at":"2025-05-13T19:04:07.748Z","avatar_url":"https://github.com/cycle.png","language":"PHP","readme":"# Cycle ORM\n\n[![Latest Stable Version](https://poser.pugx.org/cycle/orm/version)](https://packagist.org/packages/cycle/orm)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/cycle/orm/badges/quality-score.png?b=2.x)](https://scrutinizer-ci.com/g/cycle/orm/?branch=2.x)\n[![Codecov](https://codecov.io/gh/cycle/orm/graph/badge.svg)](https://codecov.io/gh/cycle/orm)\n[![Discord](https://img.shields.io/static/v1?label=Discord\u0026message=chat\u0026logo=Discord\u0026color=%235865F2)](https://discord.gg/qF3HpXhMEP)\n[![Meta Storm Plugin](https://img.shields.io/static/v1?\u0026label=Powered+by\u0026message=Meta+Storm+Plugin\u0026logo=phpstorm\u0026color=aa55ee)](https://github.com/xepozz/meta-storm-idea-plugin)\n\n\u003cimg src=\"https://cycle-orm.dev/cycle.png\" height=\"135px\" alt=\"Cycle ORM\" align=\"left\"/\u003e\n\nCycle is PHP DataMapper, ORM and Data Modelling engine designed to safely work in classic and daemonized PHP\napplications (like [RoadRunner](https://github.com/spiral/roadrunner)). The ORM provides flexible configuration options\nto model datasets, powerful query builder and supports dynamic mapping schema. The engine can work with plain PHP\nobjects, support annotation declarations, and proxies via extensions.\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://cycle-orm.dev/docs\"\u003e\u003cb\u003eWebsite and Documentation\u003c/b\u003e\u003c/a\u003e | \u003ca href=\"https://github.com/cycle/docs/issues/3\"\u003eComparison with Eloquent and Doctrine\u003c/a\u003e\n\u003c/p\u003e\n\n## Features\n\n- ORM with has-one, has-many, many-through-many and polymorphic relations\n- Plain Old PHP objects, [AR](https://github.com/https://github.com/cycle/active-record), Custom objects\n  or [same entity type for multiple repositories](https://github.com/cycle/orm/tree/2.x/tests/ORM/Functional/Driver/Common/Classless)\n- eager and lazy loading, query builder with multiple fetch strategies\n- embedded entities, lazy/eager loaded embedded partials\n- runtime configuration with/without code-generation\n- column-to-field mapping, single table inheritance, value objects support\n- hackable: persist strategies, mappers, relations, transactions\n- works with directed graphs and cyclic graphs using command chains\n- designed to work in long-running applications: immutable service core, disposable UoW\n- supports MySQL, MariaDB, PostgresSQL, SQLServer, SQLite\n- schema scaffolding, introspection, migrations and debugging\n- supports global query scopes, UUIDs as PK, soft deletes, auto timestamps and macros\n- custom column types, FKs to non-primary columns\n- use with or without annotations, proxy classes, and auto-migrations\n- compatible with Doctrine Collections, Illuminate Collections and custom collections\n- compatible with Doctrine Annotations, PHP8 attributes\n\n## Extensions\n\n| Component                                                                                 | Current Status                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |\n|-------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [cycle/active-record](https://github.com/cycle/active-record)                             | ![License](https://img.shields.io/packagist/l/cycle/active-record.svg?style=flat-square\u0026label=) [![PHP](https://img.shields.io/packagist/php-v/cycle/active-record.svg?style=flat-square\u0026logo=php)](https://packagist.org/packages/cycle/active-record) [![Stable Release](https://poser.pugx.org/cycle/active-record/version?style=flat-square)](https://packagist.org/packages/cycle/active-record) [![Total Downloads](https://img.shields.io/packagist/dt/cycle/active-record.svg?style=flat-square)](https://packagist.org/packages/cycle/active-record/stats)                                                                                                   |\n| [cycle/schema-builder](https://github.com/cycle/schema-builder)                           | ![License](https://img.shields.io/packagist/l/cycle/schema-builder.svg?style=flat-square\u0026label=) [![PHP](https://img.shields.io/packagist/php-v/cycle/schema-builder.svg?style=flat-square\u0026logo=php)](https://packagist.org/packages/cycle/schema-builder) [![Stable Release](https://poser.pugx.org/cycle/schema-builder/version?style=flat-square)](https://packagist.org/packages/cycle/schema-builder) [![Total Downloads](https://img.shields.io/packagist/dt/cycle/schema-builder.svg?style=flat-square)](https://packagist.org/packages/cycle/schema-builder/stats)                                                                                            |\n| [cycle/schema-renderer](https://github.com/cycle/schema-renderer)                         | ![License](https://img.shields.io/packagist/l/cycle/schema-renderer.svg?style=flat-square\u0026label=) [![PHP](https://img.shields.io/packagist/php-v/cycle/schema-renderer.svg?style=flat-square\u0026logo=php)](https://packagist.org/packages/cycle/schema-renderer) [![Stable Release](https://poser.pugx.org/cycle/schema-renderer/version?style=flat-square)](https://packagist.org/packages/cycle/schema-renderer) [![Total Downloads](https://img.shields.io/packagist/dt/cycle/schema-renderer.svg?style=flat-square)](https://packagist.org/packages/cycle/schema-renderer/stats)                                                                                     |\n| [cycle/schema-provider](https://github.com/cycle/schema-provider)                         | ![License](https://img.shields.io/packagist/l/cycle/schema-provider.svg?style=flat-square\u0026label=) [![PHP](https://img.shields.io/packagist/php-v/cycle/schema-provider.svg?style=flat-square\u0026logo=php)](https://packagist.org/packages/cycle/schema-provider) [![Stable Release](https://poser.pugx.org/cycle/schema-provider/version?style=flat-square)](https://packagist.org/packages/cycle/schema-provider) [![Total Downloads](https://img.shields.io/packagist/dt/cycle/schema-provider.svg?style=flat-square)](https://packagist.org/packages/cycle/schema-provider/stats)                                                                                     |\n| [cycle/annotated](https://github.com/cycle/annotated)                                     | ![License](https://img.shields.io/packagist/l/cycle/annotated.svg?style=flat-square\u0026label=) [![PHP](https://img.shields.io/packagist/php-v/cycle/annotated.svg?style=flat-square\u0026logo=php)](https://packagist.org/packages/cycle/annotated) [![Stable Release](https://poser.pugx.org/cycle/annotated/version?style=flat-square)](https://packagist.org/packages/cycle/annotated) [![Total Downloads](https://img.shields.io/packagist/dt/cycle/annotated.svg?style=flat-square)](https://packagist.org/packages/cycle/annotated/stats)                                                                                                                               |\n| [cycle/migrations](https://github.com/cycle/migrations)                                   | ![License](https://img.shields.io/packagist/l/cycle/migrations.svg?style=flat-square\u0026label=) [![PHP](https://img.shields.io/packagist/php-v/cycle/migrations.svg?style=flat-square\u0026logo=php)](https://packagist.org/packages/cycle/migrations) [![Stable Release](https://poser.pugx.org/cycle/migrations/version?style=flat-square)](https://packagist.org/packages/cycle/migrations) [![Total Downloads](https://img.shields.io/packagist/dt/cycle/migrations.svg?style=flat-square)](https://packagist.org/packages/cycle/migrations/stats)                                                                                                                        |\n| [cycle/entity-behavior](https://github.com/cycle/entity-behavior)                         | ![License](https://img.shields.io/packagist/l/cycle/entity-behavior.svg?style=flat-square\u0026label=) [![PHP](https://img.shields.io/packagist/php-v/cycle/entity-behavior.svg?style=flat-square\u0026logo=php)](https://packagist.org/packages/cycle/entity-behavior) [![Stable Release](https://poser.pugx.org/cycle/entity-behavior/version?style=flat-square)](https://packagist.org/packages/cycle/entity-behavior) [![Total Downloads](https://img.shields.io/packagist/dt/cycle/entity-behavior.svg?style=flat-square)](https://packagist.org/packages/cycle/entity-behavior/stats)                                                                                     |\n| [cycle/entity-behavior-uuid](https://github.com/cycle/entity-behavior-uuid)               | ![License](https://img.shields.io/packagist/l/cycle/entity-behavior-uuid.svg?style=flat-square\u0026label=) [![PHP](https://img.shields.io/packagist/php-v/cycle/entity-behavior-uuid.svg?style=flat-square\u0026logo=php)](https://packagist.org/packages/cycle/entity-behavior-uuid) [![Stable Release](https://poser.pugx.org/cycle/entity-behavior-uuid/version?style=flat-square)](https://packagist.org/packages/cycle/entity-behavior-uuid) [![Total Downloads](https://img.shields.io/packagist/dt/cycle/entity-behavior-uuid.svg?style=flat-square)](https://packagist.org/packages/cycle/entity-behavior-uuid/stats)                                                  |\n| [cycle/database](https://github.com/cycle/database)                                       | ![License](https://img.shields.io/packagist/l/cycle/database.svg?style=flat-square\u0026label=) [![PHP](https://img.shields.io/packagist/php-v/cycle/database.svg?style=flat-square\u0026logo=php)](https://packagist.org/packages/cycle/database) [![Stable Release](https://poser.pugx.org/cycle/database/version?style=flat-square)](https://packagist.org/packages/cycle/database) [![Total Downloads](https://img.shields.io/packagist/dt/cycle/database.svg?style=flat-square)](https://packagist.org/packages/cycle/database/stats)                                                                                                                                      |\n| [cycle/schema-migrations-generator](https://github.com/cycle/schema-migrations-generator) | ![License](https://img.shields.io/packagist/l/cycle/schema-migrations-generator.svg?style=flat-square\u0026label=) [![PHP](https://img.shields.io/packagist/php-v/cycle/schema-migrations-generator.svg?style=flat-square\u0026logo=php)](https://packagist.org/packages/cycle/schema-migrations-generator) [![Stable Release](https://poser.pugx.org/cycle/schema-migrations-generator/version?style=flat-square)](https://packagist.org/packages/cycle/schema-migrations-generator) [![Total Downloads](https://img.shields.io/packagist/dt/cycle/schema-migrations-generator.svg?style=flat-square)](https://packagist.org/packages/cycle/schema-migrations-generator/stats) |\n| [cycle/orm-promise-mapper](https://github.com/cycle/orm-promise-mapper)                   | ![License](https://img.shields.io/packagist/l/cycle/orm-promise-mapper.svg?style=flat-square\u0026label=) [![PHP](https://img.shields.io/packagist/php-v/cycle/orm-promise-mapper.svg?style=flat-square\u0026logo=php)](https://packagist.org/packages/cycle/orm-promise-mapper) [![Stable Release](https://poser.pugx.org/cycle/orm-promise-mapper/version?style=flat-square)](https://packagist.org/packages/cycle/orm-promise-mapper) [![Total Downloads](https://img.shields.io/packagist/dt/cycle/orm-promise-mapper.svg?style=flat-square)](https://packagist.org/packages/cycle/orm-promise-mapper/stats)                                                                |\n\n## Example:\n\n```php\n// load all active users and pre-load their paid orders sorted from newest to olders\n// the pre-load will be complete using LEFT JOIN\n$users = $orm-\u003egetRepository(User::class)\n    -\u003eselect()\n    -\u003ewhere('active', true)\n    -\u003eload('orders', [\n        'method' =\u003e Select::SINGLE_QUERY,\n        'load'   =\u003e function($q) {\n            $q-\u003ewhere('paid', true)-\u003eorderBy('timeCreated', 'DESC');\n        }\n    ])\n    -\u003efetchAll();\n\n$em = new EntityManager($orm);\n\nforeach($users as $user) {\n    $em-\u003epersist($user);\n}\n\n$em-\u003erun();\n```\n\n## License:\n\nCycle ORM is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).\nMaintained by [Spiral Scout](https://spiralscout.com).\n","funding_links":["https://github.com/sponsors/cycle"],"categories":["PHP","Table of Contents","目录","Databases \u0026 ORMs"],"sub_categories":["Database","数据库 Database"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycle%2Form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcycle%2Form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcycle%2Form/lists"}