scaleupstack/easy-object 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

scaleupstack/easy-object

Composer 安装命令:

composer require scaleupstack/easy-object

包简介

Convenient object handling for a modern, defensive and strict style of programming in PHP without boilerplate code. E.g. default getters, typed properties, named/default constructors.

README 文档

README

This library provides convenient object handling for a modern, defensive and strict style of programming in PHP.

This library reduces boilerplate code dramatically, and offers features that PHP does not support (yet), e.g.:

  • structs,

  • immutable objects,

  • typed properties, including union types,

  • default getters,

  • simplified setup of test fixtures,

  • no dynamic/un-defined properties in objects

This library is based on scaleupstack/metadata and scaleupstack/reflection.

Installation

Use Composer to install this library:

$ composer require scaleupstack/easy-object

Introduction

The main motivation while developing this library, is to simplify modelling of your business domain in the sense of Domain-Driven Design (DDD), Event-Sourcing (ES) and Command Query Responsibility Segregation (CQRS). But of course, you are not limited to that.

Currently, you can enhance your objects with default features like:

  • standard getters,

  • standard constructors and named constructors (a.k.a. factory methods),

  • typed properties, including union types, and

  • a simplified and maintainable set-up of fixtures in your tests.

And it's very easy to implement additional features.

To understand the usage of the library, there are three things:

Features, considered for the future, include:

  • preventing dynamic/undefined properties,

  • serialization,

  • working on evolving data structures without updating all clients (e.g. for new versions of domain events),

  • validation?

  • virtual setters? (Easy; but don't you want to write intention-revealing methods to transform the state of your objects?)

  • read-only properties? (I'm comfortable with default getters.)

Checkout [src/Traits/] to find out, how it works. (I'm not sure if I want to deliver these traits in the future. It might be better to provide them as examples. So it might be a good idea to copy these traits in your project; or at least create your project-specific traits that include these traits.)

This library is based on scaleupstack/metadata (including [scaleupstack/annotations]), and scaleupstack/reflection. Via extension points in this library, and in scaleupstack/metadata you can add additional meta-programming for your use-cases.

TODO: TBD

Current State

This library will be developed further in the context of an internal project. I do not expect big refactorings or BC breaks. (One minor BC issue might be the removal of src/Traits/ as mentioned above.)

If you are missing anything, feel free to contact me, or create a pull request.

Please, feel free to contact me, when you evaluate this library. I'd be happy to discuss ideas, or will be more sensible when breaking things.

Contribute

Thanks that you want to contribute to ScaleUpStack/EasyObject.

License

Please check LICENSE.md in the root dir of this package.

Copyright

ScaleUpVentures Gmbh, Germany
Thomas Nunninger thomas.nunninger@scaleupventures.com
www.scaleupventures.com

统计信息

  • 总下载量: 15
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-09-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固