maatify/data-fakes

Complete fake simulation layer for MySQL, DBAL, Redis, and Mongo adapters.

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/maatify/data-fakes

v1.0.0 2025-11-22 05:38 UTC

This package is auto-updated.

Last update: 2025-11-22 05:41:19 UTC


README

Maatify.dev

Version PHP Build

Monthly Downloads Total Downloads

Stars License Status Code Quality

PHPStan Coverage

Changelog Security

πŸ“˜ Maatify Data Fakes

In-Memory Fake Adapters for MySQL, Redis, and MongoDB Version: 1.0.0 Project: maatify/data-fakes Author: Maatify.dev

πŸš€ Overview

maatify/data-fakes is a lightweight, deterministic in-memory data simulation engine compatible with all official Maatify Data Adapters.

It allows any repository or service to be tested without real databases, providing:

  • Fake MySQL Adapter
  • Fake MySQL DBAL Adapter
  • Fake Redis Adapter
  • Fake MongoDB Adapter
  • Fully deterministic test isolation
  • Zero external services required (ideal for CI)

All Fake Adapters follow the exact same contracts used by real adapters.

πŸ”‘ Core Dependencies

The entire library depends on two interfaces:

  1. Maatify\Common\Contracts\Adapter\AdapterInterface
  2. Maatify\DataAdapters\Contracts\ResolverInterface

This ensures 1:1 behavior between fake and real data layers.

🧩 Features

  • In-memory table/collection simulation

  • Auto-increment support

  • MQL-like operators for fake Mongo

  • Redis-like lists, hashes, counters, TTL

  • SQL-like filtering, ordering, limit/offset

  • Adapter lifecycle support:

    • connect(), disconnect()
    • healthCheck()
    • isConnected()
    • getDriver()
  • Test isolation using a shared FakeStorageLayer

πŸ“¦ Installation

composer require maatify/data-fakes --dev

This library is intended for testing environments, not production.

πŸ§ͺ Basic Usage

Use Fake Resolver

use Maatify\DataFakes\Resolvers\FakeResolver;

$resolver = new FakeResolver();
$db = $resolver->resolve('mysql:main', true);

$rows = $db->select('users', ['id' => 1]);

Reset Between Tests

FakeStorageLayer::reset();

πŸ“ Fake Adapters Included

  • FakeMySQLAdapter
  • FakeMySQLDbalAdapter
  • FakeRedisAdapter
  • FakeMongoAdapter
  • FakeResolver

πŸ“ Documentation

For full implementation details, see:

πŸ‘‰ README.full.md

This includes:

  • Architecture design
  • Phase breakdown
  • API Map
  • Class overview
  • Tests summary
  • Internal notes

πŸͺͺ License

MIT license Β© Maatify.dev
You’re free to use, modify, and distribute this library with attribution.

πŸ‘€ Author

Β© 2025 Maatify.dev
Engineered by Mohamed Abdulalim (@megyptm) β€” https://www.maatify.dev

πŸ“˜ Full documentation & source code:
https://github.com/Maatify/data-fakes

🀝 Contributors

Special thanks to the Maatify.dev engineering team and open-source contributors.

Built with ❀️ by Maatify.dev β€” Unified Ecosystem for Modern PHP Libraries