PHPackages                             flyokai/magento-dto - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. flyokai/magento-dto

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

flyokai/magento-dto
===================

Magento dtos, traits, enums

v1.1.7(3w ago)1804↓80.4%MITPHP

Since Dec 6Pushed 3w agoCompare

[ Source](https://github.com/flyokai/magento-dto)[ Packagist](https://packagist.org/packages/flyokai/magento-dto)[ RSS](/packages/flyokai-magento-dto/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (1)Dependencies (3)Versions (16)Used By (0)

flyokai/magento-dto
===================

[](#flyokaimagento-dto)

> User docs → [`README.md`](README.md) · Agent quick-ref → [`CLAUDE.md`](CLAUDE.md) · Agent deep dive → [`AGENTS.md`](AGENTS.md)

> Magento-specific DTOs, container classes, and enums for catalog (products, categories), sales (orders, quotes), inventory, scope, and system configuration.

A vocabulary layer over `flyokai/data-mate`. Most entities are `GreyData`-based for flexible Magento payloads; identity (`HasId`, `HasAltId`) is set up consistently so generic flyokai code can index them.

Features
--------

[](#features)

- Cart / Quote / Address / AddressItem with Jar containers (SplObjectStorage parent/child)
- Category tree with name-path / URL-path indexes
- Product / Product\\Attribute hierarchy with scoped data and global fallback
- Sales\\Order with parent/child item relationships and quote item mappings
- Scope management (Store, Website, Container) with siblings lookups
- Comprehensive Magento enum set, including `TableName` (70+ table constants)
- Helpers: `ResolvedSkus`, `UrlKeys`, `CustomerGroup`, `EntityType`

Installation
------------

[](#installation)

```
composer require flyokai/magento-dto
```

Quick start
-----------

[](#quick-start)

```
use Flyokai\MagentoDto\Quote;
use Flyokai\MagentoDto\Sales\Order;
use Flyokai\MagentoDto\Definition\TableName;
use Flyokai\MagentoDto\Definition\Feature;

$quote = new Quote();
$quote->set('grand_total', 99.99);
$quote->set('increment_id', 'Q123');

$quote->id();              // null until persisted (or hashId fallback)
$quote->altId('increment_id');  // 'Q123'

$order = new Order();
$order->set('increment_id', 'O100000123');
TableName::CatalogProductEntity->value;   // 'catalog_product_entity'
```

Catalog
-------

[](#catalog)

### Category

[](#category)

ClassNotes`Category`A node with `name_path` (array), URL paths, hierarchy level`CategoryContainer`Tree with indexes by `rowId`, `seqId`, `urlPath`, `namePath``Category\Attribute`, `Category\Attribute\Option`, `Category\Attribute\OptionContainer`, `Category\AttributeContainer`Attribute model`CategoryData`, `CategoryDataContainer`Scoped attribute data — store-specific with global fallback### Product

[](#product)

ClassNotes`Product\Attribute`, `Product\Attribute\Option`, `Product\Attribute\OptionContainer`, `Product\AttributeContainer`Attribute model`Product\LinkType`, `Product\LinkTypeAttribute`, `Product\LinkTypeContainer`Link types and their attributes`ProductData`, `ProductDataContainer`Scoped data with `getValue($field, $storeId)` falling back to `storeId=0`Cart / Quote
------------

[](#cart--quote)

ClassPurpose`Quote`Main cart container; `altIdKeys: ['increment_id']``Quote\Item`, `Quote\Address`, `Quote\AddressItem`, `Quote\Product`, `Quote\DummyItem`Cart elements`CartItem` (interface)`hashId()``ItemJar`, `AddressItemJar`, `AddressJar`, `ProductJar`SplObjectStorage-based collections (parent/child relationships work with unsaved items)`RateRequest`, `RateMethod`, `RateError`, `RateResult`Shipping ratesSales / Order
-------------

[](#sales--order)

ClassNotes`Sales\Order`Main order entity; `altIdKeys: ['increment_id']``Sales\Order\Item`with weeeAmount/weeeTax`Sales\Order\ItemJar`Parent/child relationships + quote item mappings`Sales\OrderHusk`Flags for PO, shipment, dummy items; qty calculation methodsScope
-----

[](#scope)

ClassNotes`ScopeStore``store_id`, `code`, `name`, `group_id`, `website_id`, `is_active`, `base_url``ScopeWebsite``website_id`, `code`, `name`, `default_group_id``ScopeContainer`Manages stores/websites; provides siblings lookupsConfiguration
-------------

[](#configuration)

ClassNotes`SystemConfig`Central config: entities, customer groups, link types, scope, media attributes, features, DDL, translations, EE GWS filters`StockConfig`Stock settings via `ConfigJar` accessors`Definition\Feature`enum: `Msi`, `RowId`, `BundleSeq`, `SuperAttrRowId`, `BundleParent````
if ($systemConfig->hasFeature(Feature::Msi)) {
    // MSI-specific logic
}
```

Enums (`Definition\` namespace)
-------------------------------

[](#enums-definition-namespace)

`BackorderOption`, `EntityType`, `Feature`, `HandlingAction`, `HandlingType`, `ProductType`, `StockItemOptionName`, `StockOptionName`, `TableName` (70+ Magento table name constants).

Helpers
-------

[](#helpers)

- `ResolvedSkus` — SKU → rowId/entityId resolver (case-sensitive option)
- `UrlKeys` — URL key → rowId/entityId resolver
- `CustomerGroup`, `CustomerGroupContainer`
- `EntityType`, `EntityTypeContainer`

Patterns
--------

[](#patterns)

- GreyData classes override `id()` with type coercion: returns `null` for falsy values (0, '', null).
- Hash-ID fallback: database ID → reference ID → `spl_object_id()`.
- Scope resolution: `getValue($field, $storeId)` falls back to `storeId=0` (global).
- Feature flagging via `SystemConfig::hasFeature()`.
- SplObjectStorage for parent/child relationships — works correctly with unsaved items.

Gotchas
-------

[](#gotchas)

- **Fragile items** — `fragile=true` skips ID validation. Code consuming such items must check `id() === null`.
- **`CategoryContainer` URL suffix** — both with-and-without suffix are indexed; lookups can be ambiguous.
- **`OptionContainer` case sensitivity** — configured per container; text is normalised in `initialize()`.
- **`TableName` enum** is intentionally large (70+ constants) — it's the canonical Magento table reference for the framework.

See also
--------

[](#see-also)

- [`flyokai/data-mate`](../data-mate/README.md) — DTO foundation
- [`flyokai/magento-amp-mate`](../magento-amp-mate/README.md) — async Magento cache backend

License
-------

[](#license)

MIT

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance95

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~17 days

Recently: every ~1 days

Total

12

Last Release

26d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/247743048?v=4)[flyokai](/maintainers/flyokai)[@flyokai](https://github.com/flyokai)

---

Top Contributors

[![wtsergo](https://avatars.githubusercontent.com/u/305326?v=4)](https://github.com/wtsergo "wtsergo (8 commits)")[![flyokai](https://avatars.githubusercontent.com/u/247743048?v=4)](https://github.com/flyokai "flyokai (6 commits)")

### Embed Badge

![Health badge](/badges/flyokai-magento-dto/health.svg)

```
[![Health](https://phpackages.com/badges/flyokai-magento-dto/health.svg)](https://phpackages.com/packages/flyokai-magento-dto)
```

###  Alternatives

[cypresslab/gitelephant

An abstraction layer for git written in PHP

6131.2M31](/packages/cypresslab-gitelephant)[icharle/wxtool

微信小程序登录、带参小程序码生成

231.6k](/packages/icharle-wxtool)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
