Download the PHP package asokol1981/abstract-mold without Composer
On this page you can find all versions of the php package asokol1981/abstract-mold. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download asokol1981/abstract-mold
More information about asokol1981/abstract-mold
Files in asokol1981/abstract-mold
Package abstract-mold
Short Description A base abstract class for centralizing all changes to an entity using user-provided data (mold pattern).
License MIT
Informations about the package abstract-mold
AbstractMold
💎 AbstractMold is a set of abstract classes and shared utilities for centralized management of entity data changes, with strict control and single-point validation.
✨ Main idea
A Mold acts as a single entry point for handling any incoming user data (creation, updates, or partial patches). All changes go through the mold to ensure:
- Whitelisted allowed fields only.
- Centralized validation and normalization logic.
- Predictable and consistent data preparation.
🧩 Two mold types
🟢 AbstractMutableMold
Allows step-by-step incremental data changes and gradual accumulation of modifications.
- Perfect for form scenarios or multi-step wizards.
- You can modify fields one by one or in batches.
- Tracks which fields were explicitly changed.
🔵 AbstractImmutableMold
Accepts base data and a patch all at once in the constructor.
- Ideal for APIs or services where you receive all data as a single payload.
- Does not allow further modification after creation (immutable approach).
🚀 Installation
🚀 Usage examples
🟢 AbstractMutableMold usage
🔵 AbstractImmutableMold usage
✅ Key advantages
- 🚦 Strict allowed fields control.
- 💾 Centralized validation logic.
- 🧩 Flexible design for different scenarios (mutable vs immutable).
- ⚡️ Built-in validated data cache for performance.
- 🛡 Safe and predictable API.
🤝 License
MIT © Aleksei Sokolov
Created in collaboration with ChatGPT (OpenAI), July 2025.