maatify / php-category
Framework-agnostic PHP library for hierarchical category management, localized content, custom fields, image roles and media assignments, with MySQL/PDO persistence and typed domain APIs.
Requires
- php: >=8.4.27 <8.5 || >=8.5.12 <9.0
- ext-ctype: *
- ext-mbstring: *
- ext-pdo: *
- ext-pdo_mysql: *
- maatify/exceptions: ^1.0
- maatify/php-persistence: >=1.0.0-rc.1 <=1.0.0-rc.1
- maatify/shared-common: ^1.0
Requires (Dev)
- php-cs-fixer/shim: ^3.95
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^12.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-15 21:22:11 UTC
README
Maatify Category
Package Status
Ecosystem / Adoption
Documentation
Framework-neutral PHP contracts and MySQL storage for hierarchical categories, content, extensible fields, image roles, and assignments to Host-owned media.
Current published release candidate · v1.0.0-rc.2 on Packagist
Package Summary
maatify/php-category provides typed commands, repositories, and public read
APIs for managing a Category tree and its related content.
Key Features
- Hierarchy, lifecycle, and deterministic ordering of Category records.
- Localized or unlocalized name and description, plus Host-defined fields with exact scopes.
- Host-defined image roles and exact-scope assignments to existing Media Asset IDs.
- Separate consumer visibility and management reads, with bounded lists and management pagination.
Requirements
Composer admits PHP >=8.4.27 <8.5 || >=8.5.12 <9.0. The CI compatibility
matrix covers Stable PHP 8.4 and 8.5 at or above their approved patch floors.
Later PHP 8 minors have forward Composer eligibility and require separate Stable
qualification before support is claimed.
The package requires ext-ctype, ext-mbstring, ext-pdo, and
ext-pdo_mysql. It uses MySQL 8.0.16+ with InnoDB and enforced CHECK
constraints. Runtime dependencies are maatify/exceptions,
maatify/shared-common, and the exact maatify/php-persistence 1.0.0-rc.1
trial. See composer.json
for the declared constraints and local verification
for the Composer and runtime checks.
Installation
Install the published RC.2 from Packagist in your Composer project. Keep
minimum-stability: stable and explicitly allow the exact Persistence release
candidate required by Category.
composer require maatify/php-category:1.0.0-rc.2 maatify/php-persistence:1.0.0-rc.1@RC
For the previously published RC.1, use its tag documentation and MIT license. That artifact has different PHP and Persistence requirements.
Quick Usage
Install the Category schema in the Host database. Pass the Host's PDO and clock to the factory:
use Maatify\Category\Content\Mutation\Command\CreateCategoryContentCommand; use Maatify\Category\Factory\CategoryFactory; use Maatify\Category\Lifecycle\Command\CreateCategoryCommand; $category = CategoryFactory::create($pdo, $clock); $categoryId = $category->categories()->create(new CreateCategoryCommand('clothing')); $category->contents()->create(new CreateCategoryContentCommand($categoryId, null, 'Clothing', null)); $visibleCategory = $category->categories()->getById($categoryId);
See the Usage Guide and runnable example for workflow steps and input, result, and ownership boundaries.
Public Runtime API
CategoryFactory returns one facade with five APIs. categories() manages the
tree, contents() manages name/description records, contentFields() manages
structured field values, imageRoles() manages the role registry, and
images() manages assignments. The Category Package Reference
defines the complete public inventory and persistence contract.
Critical Runtime Behavior
Consumer reads enforce active, non-deleted ancestor visibility. Management reads expose typed filters for administrative inspection. For exact scopes, a null language, platform, or role means the null value itself. Locale fallback and Media Asset resolution are Host responsibilities.
The Host owns the PDO connection, outer transaction, and clock. Services
reuse that connection and preserve Host commit and rollback. The package
classifies selected storage errors. Unclassified driver failures can
propagate as PDOException; the Host maps errors to its transport or UI.
Documentation
- Consumer Usage Guide
- Executable examples
- Category Package Reference
- Schema setup
- Changelog
- Contributing
- Security policy
Quality Status
See local verification for Composer, static analysis, code style, MySQL tests, and external Composer consumer verification. Category is pre-Stable. See the Security Policy for support status.
License
The RC.2 artifact is proprietary to Maatify Ltd. Obtain written authorization before use by requesting a free license from support@maatify.dev. Include your organization name, if applicable, and an email address for the person who should receive security advisories and critical update notices. Maatify Ltd. uses those details to administer licenses and send those notices. See LICENSE for the terms.
Author
Engineered by Mohamed Abdulalim (@megyptm)
Backend Lead & Technical Architect
https://www.maatify.dev
Built with ❤️ by Maatify.dev — Unified Ecosystem for Modern PHP Libraries