Core Foundation Helper Library for the Maatify Ecosystem
This document provides the full technical documentation for maatify/common v2.0.0,
covering its finalized scope as a pure, framework-agnostic helper library.
⚠️ Starting from v2.0.0,maatify/commonintentionally contains no infrastructure, no storage, and no contracts. All adapter, repository, Redis, and KV logic has been migrated to dedicated packages.
- Introduction
- Core Modules
- Design Scope & Architecture
- Directory Structure
- Testing & Coverage
- Migration Notes (1.x → 2.0.0)
- License
maatify/common is the lowest-level shared dependency in the Maatify ecosystem.
It provides pure, reusable building blocks that are:
- framework-agnostic
- storage-agnostic
- side-effect free
- safe to reuse across all environments
The library focuses exclusively on helpers, DTOs, traits, enums, and validation utilities that can be consumed safely by any higher-level package.
Unified DTOs and helpers for paginated API responses and in-memory collections.
Includes:
PaginationDTOPaginationResultDTOPaginationHelper
Centralized input sanitization built on top of HTMLPurifier.
Includes:
InputSanitizerSanitizesInputTrait
Ensures XSS-safe, normalized input handling.
Reusable patterns shared across the ecosystem.
Includes:
SingletonTraitSanitizesInputTrait
Designed for safe reuse and predictable lifecycle behavior.
Low-level string manipulation helpers.
Includes:
TextFormatterPlaceholderRendererRegexHelperSecureCompare
Localization-friendly date/time helpers.
Includes:
DateFormatterDateHelper
Supports humanized differences and timezone conversion.
Input validation and cleanup utilities.
Includes:
ValidatorFilterArrayHelper
Supports email, URL, UUID, slug validation and array normalization.
Centralized enums and constants used across the ecosystem.
Includes:
TextDirectionEnumMessageTypeEnumErrorCodeEnumPlatformEnumAppEnvironmentEnumEnumHelper
General-purpose helpers designed for fluent and expressive code.
Functional-style helper to execute a callback on a value and return the same value unchanged.
Used for:
- fluent initialization
- inline configuration
- readable pipelines
maatify/common must never contain:
- adapters
- repositories
- storage logic
- Redis / KV abstractions
- connectivity or DSN handling
- IO-related behavior
┌──────────────────────────────┐
│ maatify/common │
│ (helpers, DTOs, enums only) │
└───────────────┬──────────────┘
│
▼
Infrastructure Packages
- data-adapters
- data-repository
- redis-cache
- security-guard
- rate-limiter
This strict boundary guarantees long-term stability and prevents scope creep.
src/
├── Pagination/
│ ├── DTO/
│ └── Helpers/
├── Helpers/
│ └── TapHelper.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
No
Contracts/, noAdapters/, noRepository/directories exist in v2.0.0.
- PHPUnit test suite fully passing
- ≈98% code coverage
- PHPStan clean
- Zero integration dependencies
- Deterministic behavior across environments
All tests validate pure logic only, without relying on external services.
This release introduces intentional breaking changes.
- RepositoryInterface
- RedisClientInterface
- KeyValueAdapterInterface
- ConnectionConfigDTO & ConnectionTypeEnum
- All adapter / storage / protocol contracts
| Old Usage (1.x) | New Location |
|---|---|
| Repository contracts | maatify/data-repository |
| Redis/KV interfaces | maatify/redis-cache / data-adapters |
| Connection DTOs | data-adapters |
Released under the MIT License — © 2025 Maatify.dev
Engineered by Mohamed Abdulalim — https://www.maatify.dev Core Architect of the Maatify Backend Ecosystem