maatify/common

Common DTOs and helpers for all maatify libraries

Installs: 192

Dependents: 3

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/maatify/common

v1.0.5 2025-11-13 21:59 UTC

This package is auto-updated.

Last update: 2025-11-13 22:01:13 UTC


README

Maatify.dev

๐Ÿ“ฆ maatify/common

Version PHP Build Monthly Downloads Total Downloads Stars License Status Code Quality

๐Ÿ Stable Release v1.0.0 โ€” The core foundational library of the Maatify.dev ecosystem providing standardized DTOs, validation, sanitization, date/time, locking, and text utilities for all backend modules.

๐Ÿ“ฆ This is the first official stable version (v1.0.0) of maatify/common, released on 2025-11-10.

๐Ÿ”— ุจุงู„ุนุฑุจูŠ ๐Ÿ‡ธ๐Ÿ‡ฆ

๐Ÿงญ Version Information

Key Value
Version 1.0.0 Stable
Release Date 2025-11-10
PHP Requirement โ‰ฅ 8.1
License MIT
Coverage 98 %
Tests Passed 66 (150 Assertions)

๐Ÿงฉ Overview

This library provides reusable, framework-agnostic building blocks (DTOs, helpers, traits, enums, and validators) shared across all Maatify ecosystem packages such as maatify/mongo-activity, maatify/psr-logger, and others.

๐Ÿ“˜ Documentation & Release Files

File Description
/docs/README.full.md Full combined documentation (Phases 1โ€“8)
/docs/enums.md Detailed reference for Enums & Constants
/docs/phases/README.phase7.md Phase 7 breakdown and EnumHelper notes
CHANGELOG.md Complete version history
CONTRIBUTING.md Contribution guidelines
VERSION Current release version

Core Modules:

  • ๐Ÿงฎ Pagination Helpers โ€” PaginationHelper, PaginationDTO, PaginationResultDTO Unified pagination structures for API responses and MySQL queries.

  • ๐Ÿ” Lock System โ€” FileLockManager, RedisLockManager, HybridLockManager Safe execution control for cron jobs, distributed tasks, and queue workers.

  • ๐Ÿงผ Security Sanitization โ€” InputSanitizer, SanitizesInputTrait Clean and escape user input safely with internal HTMLPurifier integration.

  • ๐Ÿง  Core Traits โ€” SingletonTrait, SanitizesInputTrait Reusable traits for singleton pattern, safe input handling, and shared helpers.

  • โœจ Text & Placeholder Utilities โ€” TextFormatter, PlaceholderRenderer, RegexHelper, SecureCompare Powerful text formatting, placeholder rendering, and secure string comparison tools.

  • ๐Ÿ•’ Date & Time Utilities โ€” DateFormatter, DateHelper Humanized difference, timezone conversion, and localized date rendering (EN/AR/FR).

  • ๐Ÿงฉ Validation & Filtering Tools โ€” Validator, Filter, ArrayHelper Email/URL/UUID/Slug validation, input detection, and advanced array cleanup utilities.

  • โš™๏ธ Enums & Constants Standardization โ€” TextDirectionEnum, MessageTypeEnum, ErrorCodeEnum, PlatformEnum, AppEnvironmentEnum, CommonPaths, CommonLimits, CommonHeaders, Defaults, EnumHelper Centralized enum and constant definitions ensuring consistent standards, reusable helpers, and unified configuration across all Maatify libraries.

โš™๏ธ 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/common integrates these open-source libraries to deliver a consistent and secure foundation for all other Maatify components.

๐Ÿง  Note: maatify/common automatically configures HTMLPurifier to use an internal cache directory at storage/purifier_cache for 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/cache

or 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: &lt;script&gt;alert(1)&lt;/script&gt;

โœจ 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, and maatify/queue-manager for 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

๐Ÿ—‚ 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. โค๏ธ

๐Ÿ“Š Phase Summary Table

Phase Title Status Files Created Notes
1 Pagination Module โœ… Completed 3 Pagination DTOs & helpers
2 Locking System โœ… Completed 6 File / Redis / Hybrid managers
3 Security & Input Sanitization โœ… Completed 3 Input cleaning & HTMLPurifier
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 & Localized Date Formatting
6 Validation & Filtering Tools โœ… Completed 3 Validator, Filter, and ArrayHelper with full unit tests
7 Enums & Constants Standardization โœ… Completed 10 + 5 tests Unified Enums, Constants, EnumHelper & JSON Trait with docs
8 Testing & Release โœ… Completed 6 CHANGELOG.md, CONTRIBUTING.md, VERSION, README.full.md, coverage results

โœ… 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

All files have been verified and finalized as part of Phase 8 (v1.0.0 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 โ€“ version 1.0.0 confirmed

๐Ÿชช License

MIT license ยฉ Maatify.dev
Youโ€™re free to use, modify, and distribute this library with attribution.

๐Ÿš€ Next Version Plan (v1.1.0)

  • Performance optimizations for string and array helpers
  • Extended Enum support with localization metadata
  • Introduce Common Cache Adapter and Metrics interfaces

๐Ÿ”— Full documentation & release notes: see /docs/README.full.md

๐Ÿงฑ 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