ObjectQuel
ObjectQuel is a query language and execution engine for PHP, with a built-in ORM, that works directly with your entity model — not a query builder, not SQL with class names swapped in. It has its own parser and execution engine, full awareness of your relationships at parse time, and a via traversal syntax that replaces manual join conditions entirely. It can query relational tables and external JSON sources in the same statement, returning fully mapped entity objects alongside scalar projections with no extra assembly required.
What makes ObjectQuel great
🎯 First-Class Query Language
ObjectQuel's range/retrieve syntax expresses queries in terms of your domain model directly — no query builder chaining, no DQL string assembly, no fluent interface ceremony. The language is the API.
🏗️ Data Mapper
Entities carry no persistence knowledge. No base classes, no magic methods, no repository leakage into your domain. The mapper is a runtime concern, not an inheritance constraint.
⚡ Performance By Design
Query decomposition, lazy loading via proxies, and metadata caching are built into the execution pipeline.
🌐 Heterogeneous Data Sources
Query across relational tables and external JSON sources in a single statement. The engine handles source resolution; your query stays uniform.
🔗 Relationship Traversal
Navigate OneToOne, OneToMany, ManyToOne, and ManyToMany relationships directly in query expressions via via clauses — no manual join conditions.
🛠️ Sculpt CLI
Entity generation, schema migrations, and reverse engineering from existing tables. Designed for gradual adoption into legacy codebases.
The Query Language
Ranges declare what entities you're working with. Retrieval specifies what you want back. The engine resolves joins, hydration, and source routing:
<?php
// Declare entity ranges, traverse relationships with `via`, filter and sort
$results = $entityManager->executeQuery("
range of p is ProductEntity
range of c is CategoryEntity via p.categories
retrieve (p, c.name)
where p.price < :maxPrice
sort by p.name asc
", [
'maxPrice' => 50.00
]);
foreach ($results as $row) {
$product = $row['p']; // Fully mapped ProductEntity
$categoryName = $row['c.name']; // Scalar projection — only what's needed
echo $product->getName() . ' in ' . $categoryName;
}