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(2mo ago)13MITPHPPHP ^8.2

Since Mar 2Pushed 2mo 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 1mo ago

READMEChangelogDependencies (4)Versions (2)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

33

—

LowBetter than 75% of packages

Maintenance85

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity32

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

77d 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

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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