ObjectQuel

ObjectQuel is a PHP query language and execution engine with a built-in ORM that works directly on your entity model—not a query builder or SQL with renamed classes. Its own parser and execution engine understand relationships at parse time, while via traversal eliminates manual joins. It can query relational and external JSON data in a single statement, returning fully mapped entities and scalar projections without extra assembly.

explanation

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;
}