Role: Core Repository Runtime Layer for Maatify Ecosystem
Type: Library
Namespace: Maatify\DataRepository
PHP Version: >=8.4
This project provides the Unified Data Access Layer for the Maatify ecosystem.
It abstracts differences between:
-
Storage Drivers
- MySQL (PDO / DBAL)
- MongoDB
- Redis (Predis / PhpRedis)
-
Execution Modes
- Real (Production)
- Fake (Testing)
-
Adapters
- Provided by
maatify/data-adaptersandmaatify/data-fakes - Handle connections and low-level access
- Provided by
-
Repositories
- Provided by
maatify/data-repository - Handle:
- Query normalization
- Hydration
- Pagination
- Repository logic
- Provided by
maatify/common(contracts, pagination DTOs)maatify/data-adapters(interfaces)maatify/bootstrapmaatify/psr-logger
- Application-specific business logic (Domain Layer)
- Framework HTTP layers (Slim, Laravel request/response objects)
The following classes and interfaces constitute the official public API.
All other components (Ops, Builders, internal helpers) are internal.
Maatify\DataRepository\Base\BaseRepository<T>Maatify\DataRepository\Generic\GenericMySQLRepository<T>Maatify\DataRepository\Generic\GenericMongoRepository<T>Maatify\DataRepository\Generic\GenericRedisRepository<T>Maatify\DataRepository\Resolver\RepositoryResolver
Maatify\DataRepository\Hydration\HydratorInterface<T>Maatify\DataRepository\Hydration\BaseHydratorMaatify\DataRepository\Hydration\AutoCasterMaatify\DataRepository\Hydration\MappingProfileMaatify\DataRepository\Hydration\TransformerInterfaceMaatify\DataRepository\Generic\Support\RepositoryHydrationTrait
Maatify\DataRepository\Pagination\PaginationResultDTO
(Alias to Common DTO)Maatify\DataRepository\Pagination\HydratedPaginationCollection<T>Maatify\DataRepository\Pagination\PaginationEntryMaatify\DataRepository\Pagination\PaginationContext
Maatify\DataRepository\Generic\Support\FilterUtilsMaatify\DataRepository\Generic\Support\OrderUtilsMaatify\DataRepository\Generic\Support\LimitOffsetValidatorMaatify\DataRepository\Generic\Support\ResultNormalizerMaatify\DataRepository\Generic\Support\NormalizerOptionsMaatify\DataRepository\Generic\Pagination\LimitOffsetConfig
Maatify\DataRepository\Generic\Support\FieldFilterMaatify\DataRepository\Generic\Support\FilterParserMaatify\DataRepository\Generic\Support\OrderFieldMaatify\DataRepository\Generic\Support\OrderParser
Verified against roadmap.json and src/ content.
| Phase | Title | Status | Evidence |
|---|---|---|---|
| 01 | Bootstrap, Exceptions, Resolver | ✅ DONE | RepositoryResolver, RepositoryException |
| 02 | Base Repository Layer | ✅ DONE | BaseRepository, base drivers |
| 03 | CRUD Layer | ✅ DONE | Generic repositories |
| 04 | Advanced Filtering | ✅ DONE | FilterUtils, FilterParser |
| 05 | Ordering & Sorting | ✅ DONE | OrderUtils, OrderParser |
| 06 | Limits & Offsets | ✅ DONE | LimitOffsetValidator |
| 07 | Result Normalization | ✅ DONE | ResultNormalizer |
| 08 | CRUD Edge Cases | ✅ DONE | Test coverage (phase-output) |
| 09 | Generic Ops Integration | ✅ DONE | MySQL / Mongo / Redis Ops |
| 10 | Pagination Hooks | ✅ DONE | PaginationEntry |
| 11 | Hydrator Contract | ✅ DONE | HydratorInterface |
| 12 | Base Hydrator Pipeline | ✅ DONE | BaseHydrator |
| 13 | Auto Casting System | ✅ DONE | AutoCaster |
| 14 | DTO Mapping & Profiles | ✅ DONE | MappingProfile, trait |
| 15 | Pagination Core | ✅ DONE | paginate() |
| 16 | Pagination Optimization | ✅ DONE | Optimized limit/offset |
| 17 | Paginated Hydrated Results | ✅ DONE | HydratedPaginationCollection |
| 18 | Integration Matrix | ✅ DONE | IntegrationValidatorTest |
| 19 | NoSQL Robustness | ✅ DONE | Redis in-memory filtering |
| 20 | SQL & Filter Improvements | ✅ DONE | Semantic placeholders |
| 21 | Architecture Decoupling | ✅ DONE | Logger injection refactor |
| 22 | FilterParser Extraction | ✅ DONE | FilterParser, FieldFilter |
| 23 | Filter Builders | ✅ DONE | MySQL / Mongo builders |
| 24 | OrderParser Extraction | ✅ DONE | OrderParser, OrderField |
| 25 | Order Builders | ✅ DONE | MySQL / Mongo builders |
| 26 | Public API Tightening | ✅ DONE | Visibility audit |
| 27 | Normalizer / Limit Config | ✅ DONE | Config objects |
| 28 | PHPStan Generics | ✅ DONE | @template T usage |
| 29 | DX & Documentation | ✅ DONE | README.full.md, examples |
| 30 | Final Release v1.0.0 | ✅ DONE | Version finalized |
| 31+ | Future Stability / Features | ⏳ PLANNED | See roadmap |
-
Test Execution
- Environment lacks PHP binaries in
$PATH - Validation performed via static analysis and code review
- Environment lacks PHP binaries in
-
Redis Filtering
- Filtering is done in-memory after key fetch
- Not suitable for massive datasets without secondary indexing
-
Strict Mode
- File system modifications restricted to designated outputs
-
Single Source of Truth
- This file (
llm-snapshot.md) overrides conversational memory
- This file (
-
No Speculation
- Do not implement planned phases unless explicitly instructed
-
Verify First
- Always check:
phase-output.jsonroadmap.jsonsrc/
- Always check:
-
Preserve Architecture
- Do not bypass
BaseRepositoryorHydratorInterface - Maintain separation between data access and hydration
- Do not bypass
roadmap.jsonphase-output.jsonapi-map.jsoncomposer.jsonsrc/Generic/GenericMySQLRepository.phpsrc/Generic/GenericMongoRepository.phpsrc/Generic/GenericRedisRepository.php
WORK_SYSTEM.md
(Not required — roadmap artifacts provided sufficient context)
HIGH
All completed phases (1–30) have corresponding:
- Source code
- Output records
- Public API definitions
The project state is consistent with a stable v1.0.0 release.