waaseyaa/typed-data
最新稳定版本:v0.1.0-alpha.179
Composer 安装命令:
composer require waaseyaa/typed-data
包简介
Type system with PHP-native facade for Waaseyaa
README 文档
README
Layer 0 — Foundation
Typed data validation and coercion for Waaseyaa applications.
Provides a type system for field and entity-adjacent values. EntityCastCoercion (Waaseyaa\TypedData\Coercion\EntityCastCoercion) is the canonical implementation for entity $casts builtins int, float, bool, string, and array (JSON string in storage): strict storage→domain and domain→storage rules shared with waaseyaa/entity ValueCaster (#1185). Failures throw CoercionException, which ValueCaster wraps as CastException for a single error model at the entity boundary.
CastTokenMapper maps entity cast tokens to TypedDataManager dataType strings (int→integer, etc.). Tokens array / json return null because JSON bags are not map/list without a schema.
Primitive types (IntegerData, FloatData, BooleanData, StringData) use getCastedValue() via the same coercion rules as entities (aligned with ValueCaster).
Symfony Validator applies DataDefinition constraints on the raw getValue() bag; coercion (EntityCastCoercion / getCastedValue) is separate from constraint validation—run both when you need normalized types and business rules.
Used by the field system (FieldItemBase, PropertyValue) and by entity casting (#1185).
Key classes: TypedDataInterface, DataDefinition, TypedDataManager, EntityCastCoercion, CastTokenMapper.
统计信息
- 总下载量: 6.54k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2026-03-14