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
Requires
- php: >=8.4
- maatify/common: ^1.0
- maatify/data-adapters: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^11.0
README
π 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:
Maatify\Common\Contracts\Adapter\AdapterInterfaceMaatify\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
FakeMySQLAdapterFakeMySQLDbalAdapterFakeRedisAdapterFakeMongoAdapterFakeResolver
π 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