Search by

maatify / php-product

Maatify

Framework-agnostic PHP library for managing Products, Variants, and configurable catalogs on MySQL.

Package info

github.com/Maatify-ltd/php-product

pkg:composer/maatify/php-product

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0-rc.1 2026-11-14 04:59 UTC

This package is not auto-updated.

Last update: 2026-11-15 00:13:26 UTC


README

Maatify Product

Maatify.dev

Status: Release Candidate Version: 1.0.0-rc.1 PHP License PHPStan Level Max

Packagist Monthly Downloads Total Downloads Maatify Ecosystem

Usage Guide Examples Package Reference Changelog Security Policy Contributing Guide

Framework-agnostic PHP library for managing Products, Variants, and configurable catalogs on MySQL.

Key Features

  • Create Products and Variants atomically. Reconfigure Options and Values with a revision check and keep Variant history.
  • Resolve shopper selections to visible Variants and paginate visible Variants, Options, Values, and exact-scope images.
  • Manage localized Content, Image Roles, and Image Assignments. The Host owns pricing, inventory, category mapping, and media storage.

Requirements

  • PHP >=8.4.27 <8.5.0 || >=8.5.12 <8.6.0 with ext-pdo, ext-pdo_mysql, and ext-mbstring
  • MySQL 8.0.16 or later (verified on 8.0.16 and 8.0.46)
  • maatify/exceptions ^1.0, maatify/php-persistence 1.0.0-rc.1, maatify/shared-common ^1.0

Installation

Product release candidate 1.0.0-rc.1 is available on Packagist. Install the exact Product and Persistence release candidates in the consumer project:

composer require maatify/php-product:1.0.0-rc.1 maatify/php-persistence:1.0.0-rc.1

Keep minimum-stability: stable and permit these exact pre-release versions in the consumer root. See License for the free license required before use.

Then install the schema once into your database:

mysql your_database < schema/product.sql

Quick Usage

use Maatify\Product\Factory\ProductFactory;
use Maatify\Product\Product\Management\Command\CreateProductCommand;
use Maatify\SharedCommon\Infrastructure\SystemClock;

// $pdo: your PDO connection with PDO::ERRMODE_EXCEPTION, on a database that has schema/product.sql.
$clock = new SystemClock(new DateTimeZone('UTC'));
$products = ProductFactory::createProductManagementService($pdo, $clock);
$catalog = ProductFactory::createProductConsumerService($pdo, $clock);

$created = $products->create(new CreateProductCommand('SIMPLE-1')); // Product + its Variant
$product = $products->getByIdForManagement($created->productId);    // inactive until activated
// $catalog->getById($created->productId) raises ProductNotFoundException until the Product is active.

Runnable versions are in examples/; the walkthroughs are in the Usage Guide.

Public Runtime API

Start with ProductFactory::forHost() to configure the Host PDO and clock once. The static factory methods also build individual services.

Services Capabilities
Products and Variants Create and reconfigure Products, manage lifecycle, look up Products by code and Variants by SKU or barcode in Management, and resolve visible Variants by composition.
Options and Option Values Manage catalog choices and read or paginate the choices visible to consumers.
Content Manage Product, Option, and Value labels and read content for an exact language.
Image Roles and Assignments Manage roles, order and defaults, and list or paginate consumer images within one exact scope.

Consumer reads apply visibility rules. Management services expose lifecycle operations and explicit filters. See the Package Reference for method signatures, behavior, and exceptions.

The Host controls its transactions. The package uses savepoints for mutations inside a Host transaction. Read getConfigurationRevision() before loading the editor data and send that revision as expectedRevision when saving. The Host owns access control and request limits.

Documentation

Quality Status

Final Gate covers PHPStan at level max, MySQL integration tests, and the Consumer Verification Harness. See CI and local verification for the full matrix and commands.

License

This package is proprietary. Request a free license from support@maatify.dev before using it. 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