fleshgrinder/value-object
最新稳定版本:v0.0.0
Composer 安装命令:
composer require fleshgrinder/value-object
包简介
Abstract value object implementation as basis for custom domain value objects.
README 文档
README
Value Object
Abstract value object package that contains the building blocks to create custom domain value objects.
Install
Open a terminal, enter your project directory and execute the following command to add this package to your dependencies:
$ composer require fleshgrinder/value-object
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Usage
There are two abstract classes and one interface in the source directory that can be used to build custom domain value
objects tailored to the needs of a project. The provided ValueObject interface is a head interface that combines some
interfaces to adhere to a contract of common methods that every value object should provide. Implementation of this
interface is recommended for totally custom behavior.
The SingleValueObject is the perfect base for building value objects that are representable by a single value. Simply
extend the abstract class and implement the necessary abstract methods and it should work out of the box. You may also
extend the SingleValueObjectTest and override the getInstance, getDefaultValue, and getDefaultUnequalValue
methods for a thorough test of your custom single valued value object.
The MultiValueObject is the perfect base for building value objects that represent multiple values. However, it only
implements the equals method that ensures that the given value is of the same instance and delegates further checks
to the extending child class. Multi valued value objects are complex and it is not possible to implement an abstraction
that fits all requirements. You may also simply implement the interface and implement the instance of check yourself if
you want.
Weblinks
- Wikipedia: Value Object
- Mathias Verraes: Casting Value Objects
- Eric Evans (2003): Domain-Driven Design: Tackling Complexity in the Heart of Software
- Wikipedia: Domain-Driven Design
- Carlos Buenosvinos, Christian Soronellas and Keyvan Akbary: Domain-Driven Design in PHP
License
fleshgrinder/value-object 适用场景与选型建议
fleshgrinder/value-object 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 63 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 09 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 fleshgrinder/value-object 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fleshgrinder/value-object 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 63
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 21
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-25