cycle/orm

PHP DataMapper ORM and Data Modelling Engine

Maintainers

👁 wolfy-j

Package info

github.com/cycle/orm

Homepage

Chat

Documentation

pkg:composer/cycle/orm

Fund package maintenance!

cycle

Statistics

Installs: 912 089

Dependents: 81

Suggesters: 1

Stars: 1 328

Open Issues: 85

v2.18.0 2026-06-15 16:45 UTC

Requires

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT a7a1db351df8037ff7a1196e19688bfc7d35c63e

  • Anton Titov (wolfy-j) <wolfy-j.woop@spiralscout.com>
  • Aleksei Gagarin (roxblnfk) <alexey.gagarin.woop@spiralscout.com>
  • Pavel Butchnev (butschster) <pavel.buchnev.woop@spiralscout.com>
  • Maksim Smakouz (msmakouz) <maksim.smakouz.woop@spiralscout.com>

ormsqlmysqlsqlitepostgresqlmssqlquery-builderdata-mapper

This package is auto-updated.

Last update: 2026-06-15 16:49:23 UTC


README

👁 Latest Stable Version
👁 Scrutinizer Code Quality
👁 Codecov
👁 Discord
👁 Meta Storm Plugin

👁 Cycle ORM

Cycle is PHP DataMapper, ORM and Data Modelling engine designed to safely work in classic and daemonized PHP applications (like RoadRunner). The ORM provides flexible configuration options to model datasets, powerful query builder and supports dynamic mapping schema. The engine can work with plain PHP objects, support annotation declarations, and proxies via extensions.

Website and Documentation | Comparison with Eloquent and Doctrine

Features

  • ORM with has-one, has-many, many-through-many and polymorphic relations
  • Plain Old PHP objects, AR, Custom objects or same entity type for multiple repositories
  • eager and lazy loading, query builder with multiple fetch strategies
  • embedded entities, lazy/eager loaded embedded partials
  • runtime configuration with/without code-generation
  • column-to-field mapping, single table inheritance, value objects support
  • hackable: persist strategies, mappers, relations, transactions
  • works with directed graphs and cyclic graphs using command chains
  • designed to work in long-running applications: immutable service core, disposable UoW
  • supports MySQL, MariaDB, PostgresSQL, SQLServer, SQLite
  • schema scaffolding, introspection, migrations and debugging
  • supports global query scopes, UUIDs as PK, soft deletes, auto timestamps and macros
  • custom column types, FKs to non-primary columns
  • use with or without annotations, proxy classes, and auto-migrations
  • compatible with Doctrine Collections, Illuminate Collections and custom collections
  • compatible with Doctrine Annotations, PHP8 attributes

Extensions

Component Current Status
cycle/active-record 👁 License
👁 PHP
👁 Stable Release
👁 Total Downloads
cycle/schema-builder 👁 License
👁 PHP
👁 Stable Release
👁 Total Downloads
cycle/schema-renderer 👁 License
👁 PHP
👁 Stable Release
👁 Total Downloads
cycle/schema-provider 👁 License
👁 PHP
👁 Stable Release
👁 Total Downloads
cycle/annotated 👁 License
👁 PHP
👁 Stable Release
👁 Total Downloads
cycle/migrations 👁 License
👁 PHP
👁 Stable Release
👁 Total Downloads
cycle/entity-behavior 👁 License
👁 PHP
👁 Stable Release
👁 Total Downloads
cycle/entity-behavior-uuid 👁 License
👁 PHP
👁 Stable Release
👁 Total Downloads
cycle/database 👁 License
👁 PHP
👁 Stable Release
👁 Total Downloads
cycle/schema-migrations-generator 👁 License
👁 PHP
👁 Stable Release
👁 Total Downloads
cycle/orm-promise-mapper 👁 License
👁 PHP
👁 Stable Release
👁 Total Downloads

Example:

// load all active users and pre-load their paid orders sorted from newest to olders
// the pre-load will be complete using LEFT JOIN
$users = $orm->getRepository(User::class)
 ->select()
 ->where('active', true)
 ->load('orders', [
 'method' => Select::SINGLE_QUERY,
 'load' => function($q) {
 $q->where('paid', true)->orderBy('timeCreated', 'DESC');
 }
 ])
 ->fetchAll();

$em = new EntityManager($orm);

foreach($users as $user) {
 $em->persist($user);
}

$em->run();

License:

Cycle ORM is open-sourced software licensed under the MIT license. Maintained by Spiral Scout.