PHPackages                             ray/fake-query - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. ray/fake-query

ActiveLibrary[Database &amp; ORM](/categories/database)

ray/fake-query
==============

1.x-dev(4mo ago)1334[1 issues](https://github.com/ray-di/Ray.FakeQuery/issues)[1 PRs](https://github.com/ray-di/Ray.FakeQuery/pulls)MITPHPPHP ^8.2

Since Mar 2Pushed 3w agoCompare

[ Source](https://github.com/ray-di/Ray.FakeQuery)[ Packagist](https://packagist.org/packages/ray/fake-query)[ RSS](/packages/ray-fake-query/feed)WikiDiscussions 1.x Synced today

READMEChangelogDependencies (4)Versions (3)Used By (0)

Ray.FakeQuery
=============

[](#rayfakequery)

A companion to [Ray.MediaQuery](https://github.com/ray-di/Ray.MediaQuery) that replaces SQL execution with JSON fixture files — no database required. Designed for testing and frontend development.

```
Ray.MediaQuery   SQL files  → DB execution → Entity
Ray.FakeQuery    JSON files → hydration    → Entity (same interface)

```

Installation
------------

[](#installation)

```
composer require ray/fake-query 1.x-dev --dev
```

Usage
-----

[](#usage)

Define query interfaces with `#[DbQuery]` as usual:

```
interface TodoQueryInterface
{
    #[DbQuery('todo_item')]
    public function item(string $todoId): ?TodoEntity;

    #[DbQuery('todo_list')]
    /** @return array */
    public function list(string $filterStatus = 'all'): array;

    #[DbQuery('todo_add')]
    public function add(string $todoId, string $title): void;
}
```

Swap modules to switch between real SQL and fake JSON:

```
// Production
$this->install(new MediaQuerySqlModule($sqlDir, $interfaceDir));

// Test / Frontend development
$this->install(new FakeQueryModule($fakeDir, $interfaceDir));
```

Create JSON files matching the query ID in `#[DbQuery]`:

`var/fake/todo_item.json` — single entity (`?Entity`):

```
{
    "todo_id": "01HVXXXXXX0008",
    "todo_title": "Buy groceries"
}
```

`var/fake/todo_list.jsonl` — collection (`array`), one object per line:

```
{"todo_id": "01HVXXXXXX0008", "todo_title": "Buy groceries"}
{"todo_id": "01HVXXXXXX0007", "todo_title": "Call dentist"}
```

`void` methods require no file — they succeed silently as no-ops.

JSON keys use `snake_case`; entity properties use `camelCase`. Conversion is automatic, matching Ray.MediaQuery behavior.

###  Health Score

34

↑

LowBetter than 75% of packages

Maintenance67

Regular maintenance activity

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

124d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/db4fc75ffc631168d0d7143b6f2c24b1534dfb921212bd851c026c5cbbb1344d?d=identicon)[koriym](/maintainers/koriym)

---

Top Contributors

[![koriym](https://avatars.githubusercontent.com/u/529021?v=4)](https://github.com/koriym "koriym (12 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ray-fake-query/health.svg)

```
[![Health](https://phpackages.com/badges/ray-fake-query/health.svg)](https://phpackages.com/packages/ray-fake-query)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[ray/media-query

PHP interface-based SQL framework

11254.8k4](/packages/ray-media-query)[bear/resource

Hypermedia framework for object as a service

48687.7k43](/packages/bear-resource)[bear/package

BEAR.Sunday application framework package

31566.2k27](/packages/bear-package)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
