maatify / common
Common DTOs and helpers for all maatify libraries
Installs: 414
Dependents: 5
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 1
Open Issues: 0
pkg:composer/maatify/common
Requires
- php: >=8.4
- ext-intl: *
- ext-mbstring: *
- ezyang/htmlpurifier: ^4.19
- maatify/psr-logger: ^1.0
Requires (Dev)
- doctrine/dbal: ^4.3
- friendsofphp/php-cs-fixer: ^3.89
- mongodb/mongodb: ^2.0
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^10.0
- predis/predis: ^2.3
README
๐ฆ maatify/common
๐ Stable Release v1.0.9 โ Redis Client Contract Added
The core foundational library of the Maatify.dev ecosystem providing standardized DTOs, validation, sanitization, date/time, locking, text utilities, and now a unified RepositoryInterface powering all Maatify data layers.
๐ฆ This is the stable version (v1.0.8) of maatify/common, released on 2025-11-22. ๐ ุจุงูุนุฑุจู ๐ธ๐ฆ
๐งญ Version Information
| Key | Value |
|---|---|
| Version | 1.0.9 Stable |
| Release Date | 2025-11-26 |
| PHP Requirement | โฅ 8.4 |
| License | MIT |
| Coverage | 98 % |
| Tests Passed | 66 (150 Assertions) |
๐งฉ Overview
This library provides reusable, framework-agnostic building blocks (DTOs, helpers, traits, enums, validators, lockingโฆ) shared across all Maatify ecosystem packages such as:
maatify/data-adaptersmaatify/data-fakesmaatify/mongo-activitymaatify/psr-loggermaatify/bootstrap
New in v1.0.9: A unified RedisClientInterface providing a minimal KV API compatible with phpredis, Predis, and FakeRedisConnection.
New in v1.0.8: A unified RepositoryInterface that standardizes CRUD operations across MySQL, Mongo, Redis, Predis, and DBAL repositories.
๐ Whatโs New in v1.0.9 (Phase 17)
โญ Redis Client Contract Added
Phase 17 introduces the RedisClientInterface, a minimal and unified Redis API surface shared across
phpredis, Predis, and the in-memory FakeRedisConnection.
โ Added
-
RedisClientInterfaceget()set()del()keys()
โ Updated
- README.full.md
- API Map
- roadmap.json
- CHANGELOG โ v1.0.9
- VERSION โ 1.0.9
- Added
/docs/phases/README.phase17.md
โ Compatibility
- Fully driver-agnostic (phpredis / predis / fakes)
- Required for next updates in:
- maatify/data-fakes (FakeRedis โ full KV compatibility)
- maatify/data-adapters (RedisAdapter)
- maatify/data-repository (cache decorators)
๐ Whatโs New in v1.0.8 (Phase 16)
โญ Repository Layer Foundation
Phase 16 introduces a standardized repository contract used across the entire Maatify ecosystem.
โ Added
-
RepositoryInterfacefind()findAll()insert()update()delete()paginate()
โ Updated
- README.full.md
- API Map
- roadmap.json
- CHANGELOG โ v1.0.8
- VERSION โ 1.0.8
- Added
/docs/phases/README.phase16.md
โ Compatibility
- 100% backward-compatible
- No breaking changes in existing adapters
- Required for the upcoming maatify/data-repository package
๐ Documentation & Release Files
| File | Description |
|---|---|
/docs/README.full.md |
Full documentation (Phases 1โ17) |
/docs/enums.md |
Enums & constants reference |
/docs/phases/README.phase16.md |
Phase 16 โ Repository Layer Foundation |
CHANGELOG.md |
Version history (updated to 1.0.9) |
CONTRIBUTING.md |
Contribution guidelines |
VERSION |
Current version โ 1.0.9 |
Core Modules:
-
๐งฎ Pagination Helpers โ
PaginationHelper,PaginationDTO,PaginationResultDTOUnified pagination structures for API responses and MySQL queries. -
๐ Lock System โ
FileLockManager,RedisLockManager,HybridLockManagerSafe execution control for cron jobs, distributed tasks, and queue workers. -
๐งผ Security Sanitization โ
InputSanitizer,SanitizesInputTraitClean and escape user input safely with internalHTMLPurifierintegration. -
๐ง Core Traits โ
SingletonTrait,SanitizesInputTraitReusable traits for singleton pattern, safe input handling, and shared helpers. -
โจ Text & Placeholder Utilities โ
TextFormatter,PlaceholderRenderer,RegexHelper,SecureComparePowerful text formatting, placeholder rendering, and secure string comparison tools. -
๐ Date & Time Utilities โ
DateFormatter,DateHelperHumanized difference, timezone conversion, and localized date rendering (EN/AR/FR). -
๐งฉ Validation & Filtering Tools โ
Validator,Filter,ArrayHelperEmail/URL/UUID/Slug validation, input detection, and advanced array cleanup utilities. -
โ๏ธ Enums & Constants Standardization โ
TextDirectionEnum,MessageTypeEnum,ErrorCodeEnum,PlatformEnum,AppEnvironmentEnum,CommonPaths,CommonLimits,CommonHeaders,Defaults,EnumHelperCentralized enum and constant definitions ensuring consistent standards, reusable helpers, and unified configuration across all Maatify libraries. -
๐ Redis Client Contract โ
RedisClientInterfaceMinimal keyโvalue Redis abstraction compatible with:- phpredis
- Predis
- FakeRedisConnection
โ๏ธ Installation
composer require maatify/common
๐ฆ Dependencies
This library directly relies on:
| Dependency | Purpose | Link |
|---|---|---|
| ezyang/htmlpurifier | Secure HTML/XSS sanitization engine | github.com/ezyang/htmlpurifier |
| psr/log | Standardized PSR-3 logging interface | www.php-fig.org/psr/psr-3 |
| phpunit/phpunit | Unit testing framework (development only) | phpunit.de |
maatify/commonintegrates these open-source libraries to deliver a consistent and secure foundation for all other Maatify components.
๐ง Note:
maatify/commonautomatically configures HTMLPurifier to use an internal cache directory atstorage/purifier_cachefor optimized performance. This ensures faster sanitization on subsequent calls without requiring manual setup.If you wish to override the cache path, set the environment variable:
HTMLPURIFIER_CACHE_PATH=/path/to/custom/cacheor modify it programmatically via:
$config->set('Cache.SerializerPath', '/custom/cache/path');
๐ง SingletonTrait
A clean, PSR-friendly Singleton implementation to manage single-instance service classes safely.
๐น Example Usage
use Maatify\Common\Traits\SingletonTrait; final class ConfigManager { use SingletonTrait; public function get(string $key): ?string { return $_ENV[$key] ?? null; } } // โ Always returns the same instance $config = ConfigManager::obj(); // โป๏ธ Reset (for testing) ConfigManager::reset();
โ Features
- Prevents direct construction, cloning, and unserialization.
- Provides static
obj()to access the global instance. - Includes
reset()for testing or reinitialization.
๐ Example Usage
๐น Paginate Array Data
use Maatify\Common\Pagination\Helpers\PaginationHelper; $items = range(1, 100); $result = PaginationHelper::paginate($items, page: 2, perPage: 10); print_r($result);
Output:
[
'data' => [11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
'pagination' => Maatify\Common\DTO\PaginationDTO {
page: 2,
perPage: 10,
total: 100,
totalPages: 10,
hasNext: true,
hasPrev: true
}
]
๐น Working with PaginationDTO
use Maatify\Common\Pagination\DTO\PaginationDTO; $pagination = new PaginationDTO( page: 1, perPage: 25, total: 200, totalPages: 8, hasNext: true, hasPrev: false ); print_r($pagination->toArray());
๐ Lock System
Advanced locking utilities to prevent concurrent executions in Cron jobs, queue workers, or API-critical flows.
๐น Available Managers
| Class | Type | Description |
|---|---|---|
FileLockManager |
Local | File-based lock stored in /tmp or any directory |
RedisLockManager |
Distributed | Uses Redis or Predis client for network-safe locking |
HybridLockManager |
Smart | Automatically chooses Redis if available, otherwise falls back to file lock |
LockCleaner |
Utility | Cleans up stale .lock files after timeouts |
LockModeEnum |
Enum | Defines whether lock should EXECUTION (non-blocking) or QUEUE (waits until free) |
๐ง Example 1 โ File Lock
use Maatify\Common\Lock\FileLockManager; $lock = new FileLockManager('/tmp/maatify/cron/report.lock', 600); if (! $lock->acquire()) { exit("Another job is running.\n"); } echo "Running safely...\n"; $lock->release();
โ๏ธ Example 2 โ Redis Lock
use Maatify\Common\Lock\RedisLockManager; $lock = new RedisLockManager('cleanup_task', ttl: 600); if ($lock->acquire()) { echo "Cleaning...\n"; $lock->release(); }
โ
Works automatically with both phpredis and predis.
If Redis is down, it logs an error via maatify/psr-logger.
๐ Example 3 โ Hybrid Lock (Recommended)
use Maatify\Common\Lock\HybridLockManager; use Maatify\Common\Lock\LockModeEnum; $lock = new HybridLockManager( key: 'daily_summary', mode: LockModeEnum::QUEUE, ttl: 600 ); $lock->run(function () { echo "Generating daily summary...\n"; });
Automatically uses Redis if available, otherwise falls back to file lock.
๐งน Example 4 โ Clean Old Locks
use Maatify\Common\Lock\LockCleaner; LockCleaner::cleanOldLocks(sys_get_temp_dir() . '/maatify/locks', 900);
๐งพ Notes
- All lock operations are fully logged (via
maatify/psr-logger). - Default lock expiration (TTL) is 300 seconds (5 minutes).
- Hybrid mode retries every 0.5 seconds when using queue mode.
๐ Directory (Lock Module)
src/Lock/
โโโ LockInterface.php
โโโ LockModeEnum.php
โโโ FileLockManager.php
โโโ RedisLockManager.php
โโโ HybridLockManager.php
โโโ LockCleaner.php
๐ Cron Lock System (Legacy Section)
This module provides simple yet powerful locking mechanisms to prevent concurrent cron executions.
Available implementations :
FileCronLockโ lightweight local lock for single-host environments.RedisCronLockโ distributed lock using Redis or Predis, automatically disabled if Redis is unavailable.
Interface:
use Maatify\Common\Lock\LockInterface;
Example:
use Maatify\Common\Lock\FileLockManager; $lock = new FileLockManager('/var/locks/daily_job.lock', 300); if (! $lock->acquire()) { exit("Cron already running...\n"); } echo "Running job...\n"; // ... job logic ... $lock->release();
โ If Redis or Predis is installed, you can use:
use Maatify\Common\Lock\RedisLockManager; $lock = new RedisLockManager('daily_job'); if ($lock->acquire()) { // do work $lock->release(); }
Redis version automatically logs a warning (and safely disables itself) if Redis isnโt available.
๐งผ Input Sanitization
Use Maatify\Common\Security\InputSanitizer to clean any user or system input safely.
use Maatify\Common\Security\InputSanitizer; echo InputSanitizer::sanitize('<script>alert(1)</script>', 'output'); // Output: <script>alert(1)</script>
โจ Text & Placeholder Utilities
Reusable text manipulation and safe string utilities shared across all Maatify libraries.
๐น PlaceholderRenderer
Safely render nested placeholders within templates.
use Maatify\Common\Text\PlaceholderRenderer; $template = 'Hello, {{user.name}} ({{user.email}})'; $data = ['user' => ['name' => 'Mohamed', 'email' => 'm@maatify.dev']]; echo PlaceholderRenderer::render($template, $data); // Output: Hello, Mohamed (m@maatify.dev)
๐น TextFormatter
Normalize, slugify, or title-case strings consistently across platforms.
use Maatify\Common\Text\TextFormatter; TextFormatter::slugify('Hello World!'); // hello-world TextFormatter::normalize('รรรร Test'); // aeoeuess-test TextFormatter::titleCase('maatify common'); // Maatify Common
๐น RegexHelper
Convenient wrapper for regex operations.
use Maatify\Common\Text\RegexHelper; RegexHelper::replace('/\d+/', '#', 'Item123'); // Item#
๐น SecureCompare
Timing-safe string comparison for token or signature checks.
use Maatify\Common\Text\SecureCompare; if (SecureCompare::equals($provided, $stored)) { echo 'Tokens match safely.'; }
โ
Includes full unit test coverage (tests/Text/*)
โ
Cross-platform transliteration with fallback normalization
โ
Used by other Maatify libraries for formatting, matching, and signature checks
๐ Directory (Text Utilities)
src/Text/
โโโ PlaceholderRenderer.php
โโโ TextFormatter.php
โโโ RegexHelper.php
โโโ SecureCompare.php
๐ง Tip: These utilities are internally leveraged by
maatify/i18n,maatify/security, andmaatify/queue-managerfor consistent text normalization, placeholder expansion, and token validation.
๐ Date & Time Utilities
Reusable date and time formatting utilities with localization and humanized difference support.
use Maatify\Common\Date\DateFormatter; use Maatify\Common\Date\DateHelper; use DateTime;
๐น Humanize Difference
Convert two timestamps into a natural, human-friendly expression:
$a = new DateTime('2025-11-09 10:00:00'); $b = new DateTime('2025-11-09 09:00:00'); echo DateFormatter::humanizeDifference($a, $b, 'en'); // "1 hour(s) ago" echo DateFormatter::humanizeDifference($a, $b, 'ar'); // "ู ูุฐ 1 ุณุงุนุฉ"
๐น Localized Date String
Format any DateTime into a locale-aware representation:
$date = new DateTime('2025-11-09 12:00:00'); echo DateHelper::toLocalizedString($date, 'ar', 'Africa/Cairo'); // ูฉ ูููู ุจุฑ ูขู ูขูฅุ ูข:ู ู ู echo DateHelper::toLocalizedString($date, 'en', 'America/New_York'); // November 9, 2025, 7:00 AM
โ
Supports English (en), Arabic (ar), and French (fr) locales
โ
Handles timezone conversion and localized month/day names automatically
โ
Backed by IntlDateFormatter for precise localization
โ
Fully covered with unit tests (tests/Date/*)
๐ Directory (Date Utilities)
src/Date/
โโโ DateFormatter.php
โโโ DateHelper.php
๐งฉ Validation & Filtering Utilities
Reusable validation, filtering, and array manipulation tools for ensuring clean and consistent input data across maatify projects.
use Maatify\Common\Validation\Validator; use Maatify\Common\Validation\Filter; use Maatify\Common\Validation\ArrayHelper;
๐น Validation
Perform quick and reliable validation for various input types:
Validator::email('user@maatify.dev'); // โ true Validator::url('https://maatify.dev'); // โ true Validator::ip('192.168.1.1'); // โ true Validator::uuid('123e4567-e89b-12d3-a456-426614174000'); // โ true Validator::slug('maatify-core'); // โ true Validator::slugPath('en/gift-card/itunes-10-usd'); // โ true
๐น Numeric & Range Validation
Validator::integer('42'); // โ true Validator::float('3.14'); // โ true Validator::between(5, 1, 10); // โ true Validator::phone('+201234567890'); // โ true
๐น Auto Type Detection
Smart helper that detects the type of input automatically:
Validator::detectType('test@maatify.dev'); // 'email' Validator::detectType('maatify-core'); // 'slug' Validator::detectType('en/gift-card/item'); // 'slug_path' Validator::detectType('42'); // 'integer' Validator::detectType('3.14'); // 'float' Validator::detectType('unknown-data'); // null
โ
Detects and differentiates between slug and slug_path
โ
Useful for dynamic API validation or auto-form field type detection
๐น Filtering
Simplify array cleaning before validation or persistence:
$data = [ 'name' => ' Mohamed ', 'email' => ' ', 'bio' => '<b>Hello</b>', 'age' => null ]; $clean = Filter::sanitizeArray($data); // Output: [ 'name' => 'Mohamed', 'bio' => '<b>Hello</b>' ]
Available methods:
Filter::trimArray(array $data)Filter::removeEmptyValues(array $data)Filter::sanitizeArray(array $data)
๐น Array Helper
Manipulate associative arrays in a functional and elegant way:
$data = [ 'user' => ['id' => 1, 'name' => 'Mohamed'], 'meta' => ['role' => 'admin', 'active' => true] ]; ArrayHelper::flatten($data); // ['user.id' => 1, 'user.name' => 'Mohamed', 'meta.role' => 'admin', 'meta.active' => true] ArrayHelper::only($data, ['user.name']); // ['user' => ['name' => 'Mohamed']] ArrayHelper::except($data, ['meta']); // ['user' => ['id' => 1, 'name' => 'Mohamed']]
โ
Fully covered by unit tests (tests/Validation/*)
โ
Integrated slugPath detection for multilingual slugs
โ
Ideal for preparing request payloads or DTO normalization
๐ Directory (Validation Utilities)
src/Validation/
โโโ Validator.php
โโโ Filter.php
โโโ ArrayHelper.php
โ๏ธ Enums & Constants Standardization
Centralized, reusable enumerations and constants shared across all Maatify libraries โ ensuring unified configuration, predictable behavior, and simplified maintenance.
๐น TextDirectionEnum
Defines text layout direction for UI and localization logic.
use Maatify\Common\Enums\TextDirectionEnum; echo TextDirectionEnum::LTR->value; // 'ltr'
๐น MessageTypeEnum
Standard system message types used in API responses, logs, and alerts.
use Maatify\Common\Enums\MessageTypeEnum; echo MessageTypeEnum::ERROR->value; // 'error'
๐น ErrorCodeEnum
Provides globally standardized error identifiers across all Maatify modules.
use Maatify\Common\Enums\ErrorCodeEnum; throw new Exception('Invalid input', ErrorCodeEnum::INVALID_INPUT->value);
๐น PlatformEnum & AppEnvironmentEnum
Enumerations for defining runtime context and environment configuration.
use Maatify\Common\Enums\PlatformEnum; use Maatify\Common\Enums\AppEnvironmentEnum; echo PlatformEnum::WEB->value; // 'web' echo AppEnvironmentEnum::PRODUCTION->value; // 'production'
๐น EnumHelper
Smart utility class that unifies enum operations like retrieving names, values, and validating entries.
use Maatify\Common\Enums\EnumHelper; use Maatify\Common\Enums\MessageTypeEnum; $names = EnumHelper::names(MessageTypeEnum::class); $values = EnumHelper::values(MessageTypeEnum::class); $isValid = EnumHelper::isValidValue(MessageTypeEnum::class, 'success'); // true
๐น EnumJsonSerializableTrait
Provides automatic JSON serialization for any Enum.
use Maatify\Common\Enums\Traits\EnumJsonSerializableTrait; use Maatify\Common\Enums\MessageTypeEnum; echo json_encode(MessageTypeEnum::SUCCESS); // 'success'
๐น Constants Classes
Organized constants for system-wide settings.
use Maatify\Common\Constants\CommonPaths; use Maatify\Common\Constants\Defaults; echo CommonPaths::LOG_PATH; // '/storage/logs' echo Defaults::DEFAULT_TIMEZONE; // 'Africa/Cairo'
โ
Full PHPUnit coverage (tests/Enums/*)
โ
EnumHelper & Trait verified for stability
โ
Consistent naming and values across all modules
๐ Redis Client Interface (Phase 17)
A unified minimal KV API that works across:
- phpredis
- Predis
- FakeRedisConnection (tests)
๐น Example โ Get & Set
use Maatify\Common\Contracts\Redis\RedisClientInterface; /** @var RedisClientInterface $redis */ $redis->set('token', 'abc123'); echo $redis->get('token'); // abc123
๐น Example โ Delete Many
$deleted = $redis->del('a', 'b', 'c'); // returns number of deleted keys
๐น Example โ Pattern Keys
print_r($redis->keys('user:*'));
๐ Directory (Enums & Constants)
src/Enums/
โโโ TextDirectionEnum.php
โโโ MessageTypeEnum.php
โโโ ErrorCodeEnum.php
โโโ PlatformEnum.php
โโโ AppEnvironmentEnum.php
โโโ EnumHelper.php
โโโ Traits/
โโโ EnumJsonSerializableTrait.php
src/Constants/
โโโ CommonPaths.php
โโโ CommonLimits.php
โโโ CommonHeaders.php
โโโ Defaults.php
๐งฉ Helpers
๐งฑ TapHelper
A lightweight, fluent utility for executing a callback on a given value (usually an object) and returning that same value unchanged โ
perfect for cleaner object initialization and inline setup.
โ๏ธ Class
Maatify\Common\Helpers\TapHelper
โ Features
- Executes a callback on a passed object or value.
- Returns the same value (object, scalar, array, etc.).
- Useful for chaining and fluent API style.
- 100% pure function โ no side effects unless your callback modifies the object.
๐ง Example Usage
use Maatify\Common\Helpers\TapHelper; use Maatify\DataAdapters\Adapters\MongoAdapter; $config = new EnvironmentConfig(__DIR__ . '/../'); $mongo = TapHelper::tap(new MongoAdapter($config), fn($a) => $a->connect()); // $mongo is now a connected adapter $client = $mongo->getConnection();
๐งพ Functional Philosophy
TapHelper follows a simple, expressive pattern inspired by functional programming:
| Principle | Description |
|---|---|
| ๐งฉ Isolation | The callback runs in isolation, returning no value. |
| ๐ Immutability | The original object/value is returned unchanged. |
| ๐งผ Clarity | Reduces boilerplate for setup code. |
| ๐ง Testability | Simple to reason about and unit-test (see TapHelperTest). |
๐งช Unit Test Reference
tests/Helpers/TapHelperTest.php
Covers:
- Returning the same object instance.
- Callback execution correctness.
- Compatibility with scalars and arrays.
vendor/bin/phpunit --filter TapHelperTest
๐งฑ Code Reference
TapHelper::tap(mixed $value, callable $callback): mixed
Executes
$callback($value)then returns$value.
๐งฉ Architectural Benefits within the Maatify Ecosystem
| Aspect | Benefit |
|---|---|
| โป๏ธ Fluent Initialization | Enables building adapters and services in one clean line. |
| ๐ง Ecosystem Consistency | Aligns with other helpers like PathHelper, EnumHelper, and TimeHelper. |
| ๐งผ Reduced Boilerplate | Replaces multiple setup lines with a single expressive call. |
| ๐งฉ Universal Reusability | Works seamlessly across all Maatify libraries (bootstrap, data-adapters, rate-limiter, redis-cache, etc.). |
๐ Full Documentation: docs/enums.md
๐ Directory Structure
src/
โโโ Pagination/
โ โโโ DTO/
โ โ โโโ PaginationDTO.php
โ โโโ Helpers/
โ โโโ PaginationHelper.php
โ โโโ PaginationResultDTO.php
โโโ Helpers/
โ โโโ TapHelper.php
โโโ Lock/
โ โโโ LockInterface.php
โ โโโ LockModeEnum.php
โ โโโ FileLockManager.php
โ โโโ RedisLockManager.php
โ โโโ HybridLockManager.php
โ โโโ LockCleaner.php
โโโ Security/
โ โโโ InputSanitizer.php
โโโ Traits/
โ โโโ SingletonTrait.php
โ โโโ SanitizesInputTrait.php
โโโ Text/
โ โโโ PlaceholderRenderer.php
โ โโโ TextFormatter.php
โ โโโ RegexHelper.php
โ โโโ SecureCompare.php
โโโ Date/
โ โโโ DateFormatter.php
โ โโโ DateHelper.php
โโโ Validation/
โโโ Validator.php
โโโ Filter.php
โโโ ArrayHelper.php
Enums/
โโโ TextDirectionEnum.php
โโโ MessageTypeEnum.php
โโโ ErrorCodeEnum.php
โโโ PlatformEnum.php
โโโ AppEnvironmentEnum.php
โโโ EnumHelper.php
โโโ Traits/
โโโ EnumJsonSerializableTrait.php
๐ Built Upon
maatify/common proudly builds upon several mature and battle-tested open-source foundations:
| Library | Description | Usage in Project |
|---|---|---|
| ezyang/htmlpurifier | Standards-compliant HTML filtering library | Powers InputSanitizer to ensure XSS-safe and standards-compliant HTML output with full Unicode support. |
| psr/log | PSR-3 logging interface | Enables standardized logging across sanitization, lock, and validation components. |
| phpunit/phpunit | PHP unit testing framework | Provides automated testing with CI/CD GitHub workflow integration. |
Huge thanks to the open-source community for their contributions, making the Maatify ecosystem secure, reliable, and extensible. โค๏ธ
โ ๐ Updated Phase Summary Table (Phases 1 โ 16)
| Phase | Title | Status | Files Created | Notes |
|---|---|---|---|---|
| 1 | Pagination Module | โ Completed | 3 | Pagination DTOs & helpers |
| 2 | Locking System | โ Completed | 6 | File / Redis / Hybrid lock managers |
| 3 | Security & Input Sanitization | โ Completed | 3 | InputCleaner, HTMLPurifier wrapper, XSS-safe normalizers |
| 3b | Core Traits โ Singleton System | โ Completed | 1 | SingletonTrait implementation |
| 4 | Text & Placeholder Utilities | โ Completed | 8 | PlaceholderRenderer, TextFormatter, RegexHelper, SecureCompare |
| 5 | Date & Time Utilities | โ Completed | 4 | HumanizeDifference, LocalizedDateFormatter, Timestamp helpers |
| 6 | Validation & Filtering Tools | โ Completed | 3 | Validator, Filter, ArrayHelper + full PHPUnit suite |
| 7 | Enums & Constants Standardization | โ Completed | 10 + 5 tests | Unified Enum system, EnumHelper, JSONSerializableTrait, ValueEnum base |
| 8 | Testing & Release (v1.0.0) | โ Completed | 6 | CHANGELOG, CONTRIBUTING, VERSION, README.full.md, CI integration, initial stable release |
| 9 | Logger Stability Update | โ Completed | 1 | PSR-3 fallback logger improvements for HybridLockManager |
| 10 | TapHelper Utility | โ Completed | 1 | Introduced TapHelper + full test coverage |
| 11 | Connectivity Foundation | โ Completed | 3 | ConnectionConfigDTO, ConnectionTypeEnum, improved DSN handling |
| 12 | Version Hotfix | โ Completed | 1 | Fixed version mismatch and updated VERSION file |
| 13 | Mutable ConnectionConfigDTO | โ Completed | 2 | Removed readonly, added runtime overrides, enhanced DSN flexibility |
| 14 | Driver Contract Modernization | โ Completed | 4 | Multi-driver AdapterInterface support (PDO, DBAL, MongoDB, Redis, Predis) |
| 15 | Redis Lock Testing Stability Update (v1.0.7) | โ Completed | 3 | FakeRedisConnection, improved FakeHealthyAdapter, realistic TTL simulation, fully deterministic lock tests |
| 16 | Repository Layer Foundation (v1.0.8) | โ Completed | 1 | Added RepositoryInterface with full CRUD contract + pagination & filters |
โ Verified Test Results
PHPUnit 10.5.58 โ PHP 8.4.4
โข Tests: 66 โข Assertions: 150 โข Coverage: ~98 %
โข Runtime: 0.076 s โข Memory: 12 MB
โข Warnings: 1 (No coverage driver available โ safe to ignore)
๐งพ Release Verification โ v1.0.9 (Phase 17)
Redis Client Contract
โญ v1.0.9 โ Unified Redis Client API
๐ง Added
src/Contracts/Redis/RedisClientInterface.php- Unified driver-agnostic Redis interface:
getsetdelkeys
โ Updated
README.mdREADME.full.mdCHANGELOG.mdโ v1.0.9VERSIONโ 1.0.9- Roadmap (phase17)
- Full phase doc โ
docs/phases/README.phase17.md
๐งช Tests
- Verified compatibility with FakeRedisConnection
- Signature-safe with Predis/PhpRedis mocks
- No breaking changes
๐งฉ Final Status
Phase 17 is completed successfully. Unified RedisClientInterface is now part of maatify/common and ready for integration with the ecosystem.
๐งพ Release Verification โ v1.0.8 (Phase 16)
Repository Layer Foundation
โญ v1.0.8 โ RepositoryInterface Introduction & Core Repository Architecture
โ Whatโs New
This release introduces the first unified repository contract inside maatify/common,
providing a clean, cross-adapter CRUD standard for all upcoming libraries.
๐ง Added
-
Maatify\Common\Contracts\RepositoryInterfacefind(int|string $id): ?arrayfindAll(array $filters = []): arrayinsert(array $data): int|stringupdate(int|string $id, array $data): booldelete(int|string $id): boolpaginate(int $page, int $perPage, array $filters = []): PaginationResultDTO
-
Added Phase 16 documentation:
docs/phases/README.phase16.md
-
Updated:
README.mdREADME.full.mdCHANGELOG.mdโ now includes v1.0.8VERSIONโ updated from 1.0.7 โ 1.0.8
๐งช Test Consistency
All existing tests remained 100% green, repository layer introduces no breaking changes.
๐ Compatibility Notes
- Fully backward compatible
- Ready foundation for
maatify/data-repositorylibrary (Phase 17+) - Works seamlessly with MySQL / Mongo / Redis adapters
โ Files Verified in Phase 16 (v1.0.8)
| File | Status |
|---|---|
src/Contracts/RepositoryInterface.php |
โ Added |
docs/phases/README.phase16.md |
โ Added |
README.md |
โ Updated |
README.full.md |
โ Updated |
CHANGELOG.md |
โ Updated |
VERSION |
โ Updated to 1.0.8 |
๐งฉ Final Status
Phase 16 is completed successfully. Repository Interface is now part of the Maatify Common Core and ready for integration with higher-level repository libraries.
All files have been verified and finalized as part of Phase 15 (v1.0.7 Stable).
- โ
/docs/README.full.mdโ full documentation merged - โ
/docs/enums.mdโ enums and constants reference - โ
/docs/phases/README.phase7.mdโ phase documentation - โ
CHANGELOG.mdโ release history initialized - โ
CONTRIBUTING.mdโ contributor guide added - โ
VERSIONโ version1.0.7confirmed
๐ Full documentation & release notes: see /docs/README.full.md
๐ชช License
MIT license ยฉ Maatify.dev
Youโre free to use, modify, and distribute this library with attribution.
๐งฑ Authors & Credits
This library is part of the Maatify.dev Core Ecosystem, designed and maintained under the technical supervision of:
๐ค Mohamed Abdulalim โ Backend Lead & Technical Architect
Lead architect of the Maatify Backend Infrastructure, responsible for the overall architecture, core library design,
and technical standardization across all backend modules within the Maatify ecosystem.
๐ www.Maatify.dev | โ๏ธ mohamed@maatify.dev
๐ค Contributors:
The Maatify.dev Engineering Team and open-source collaborators who continuously help refine, test, and extend
the capabilities of this library across multiple Maatify projects.
๐งฉ This project represents a unified engineering effort led by Mohamed Abdulalim, ensuring every Maatify backend component
shares a consistent, secure, and maintainable foundation.
Built with โค๏ธ by Maatify.dev โ Unified Ecosystem for Modern PHP Libraries