Framework-agnostic PHP library for managing Products, Variants, and configurable catalogs on MySQL.
- 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.
- PHP
>=8.4.27 <8.5.0 || >=8.5.12 <8.6.0withext-pdo,ext-pdo_mysql, andext-mbstring - MySQL
8.0.16or later (verified on8.0.16and8.0.46) maatify/exceptions^1.0,maatify/php-persistence1.0.0-rc.1,maatify/shared-common^1.0
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.1Keep 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.sqluse 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.
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.
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.
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.
Engineered by Mohamed Abdulalim (@megyptm)
Backend Lead & Technical Architect
https://www.maatify.dev