cycle/orm
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.
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
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.
Related Packages
tommyknocker/pdo-database-class
Framework-agnostic PHP database library with unified API for MySQL, MariaDB, Pos...
6,316
82
activerecord
ai-analysis
ai-database-assistant
ai-powered
anthropic
batch-processing
bulk-operations
cli-tools
common-table-expressions
connection-pooling
connection-retry
cross-apply
cross-platform
csv-loader
cte
cursor-pagination
database
database-abstraction-layer
database-optimization-ai
dbal
ddl
deepseek
delete-join
dialect-specific-types
distinct-on
dump
error-diagnostics
event-dispatcher
except
exception-hierarchy
explain-analysis
export-helpers
filter-clause
fluent-api
framework-agnostic
full-text-search
google-ai
helper-functions
insert-select
intersect
json-loader
lateral-join
lightweight
load-balancing
mariadb
merge-statements
microsoft-ai
migrations
mssql
mysql
ollama
openai
oracle
orm
outer-apply
pagination
pdo
pdo-db
pdo-oci
pdodb
performance
php8
plugin-system
postgresql
prepared-statements
psr-14
psr-16
query-builder
query-caching
query-compilation-cache
query-debugging
query-macros
query-monitoring
query-optimization-ai
query-profiling
query-scopes
read-write-splitting
recursive-cte
regexp
relationships
restore
savepoints
schema-builder
schema-inspector
schema-introspection
security
seeds
set-operations
sharding
sql-builder
sql-formatter
sql-injection
sql-server
sqlite
table-locking
transactions
type-safe
union
update-join
upsert
user-management
validation
window-functions
xml-loader
yandex-ai
yii2-inspired
zero-dependencies
repat/laravel-medoo
Laravel Facade and ServiceProvider for The Lightest PHP database framework to ac...
248
5
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
634,760,849
9,707
