Skip to content

Commit b1e0eb6

Browse files
Improved README.md, updated composer.json.
1 parent d3fec1a commit b1e0eb6

2 files changed

Lines changed: 81 additions & 23 deletions

File tree

README.md

Lines changed: 73 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,95 @@
11
# ScaleUpStack/EasyObject
22

3-
This library provides easy object handling, like
3+
This library provides convenient object handling for a modern, defensive and strict style of programming in PHP.
44

5-
* read-only properties
6-
* typed properties
7-
* default constructor
5+
This library reduces boilerplate code dramatically, and offers features that PHP does not support (yet), e.g.:
86

9-
No boilerplate code.
7+
* structs,
108

11-
It is a good base for Domain-Driven Design (DDD), Event Sourcing, CQRS, and an ORM that integrates in legacy applications.
9+
* immutable objects,
10+
11+
* typed properties, including union types,
12+
13+
* default getters,
14+
15+
* simplified setup of test fixtures,
16+
17+
* no dynamic/un-defined properties in objects
18+
19+
20+
This library is based on [scaleupstack/metadata] and [scaleupstack/reflection].
1221

1322

1423
## Installation
1524

1625
Use [Composer] to install this library:
1726

1827
```
19-
$ composer require scaleupventures/easy-object
28+
$ composer require scaleupstack/easy-object
2029
```
2130

2231

2332
## Introduction
2433

25-
...
34+
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.
35+
36+
37+
Currently, you can enhance your objects with default features like:
38+
39+
* standard getters,
40+
41+
* standard constructors and named constructors (a.k.a. factory methods),
42+
43+
* typed properties, including union types, and
44+
45+
* a simplified and maintainable set-up of fixtures in your tests.
46+
47+
And it's very easy to implement additional features.
48+
49+
To understand the usage of the library, there are three things:
50+
51+
* The library offers magic behaviour, e.g. check-out [src/Magic/VirtualGetter.php](https://github.com/scaleupstack/easy-object/tree/master/src/Magic/VirtualGetter.php) or [src/Magic/NamedConstructor.php](https://github.com/scaleupstack/easy-object/tree/master/src/Magic/NamedConstructor.php).
52+
53+
* Next you need some trait where you include the relevant features, e.g. [src/Traits/FixtureBuilderTrait.php](https://github.com/scaleupstack/easy-object/tree/master/src/Traits/FixtureBuilderTrait.php). To get an idea, how to include static and non-static methods, checkout [tests/Resources/Magic/ClassForNamedConstructorTesting.php](https://github.com/scaleupstack/easy-object/tree/master/tests/Resources/Magic/ClassForNamedConstructorTesting.php). (Even the magic is not included as trait here, that is not a big deal.)
54+
55+
* Finally you need to annotate your entities and use the correct trait, e.g. as done in [tests/Resources/Traits/EntityForTesting.php](https://github.com/scaleupstack/easy-object/tree/master/tests/Resources/Traits/EntityForTesting.php), [tests/Resources/Traits/FixtureBuilderForTesting.php](https://github.com/scaleupstack/easy-object/tree/master/tests/Resources/Traits/FixtureBuilderForTesting.php), or [tests/Resources/Magic/ClassForDispatcherTesting.php](https://github.com/scaleupstack/easy-object/tree/master/tests/Resources/Magic/ClassForDispatcherTesting.php).
56+
57+
Features, considered for the future, include:
58+
59+
* preventing dynamic/undefined properties,
60+
61+
* serialization,
62+
63+
* working on evolving data structures without updating all clients (e.g. for new versions of domain events),
64+
65+
* validation?
66+
67+
* virtual setters? (Easy; but don't you want to write intention-revealing methods to transform the state of your objects?)
68+
69+
* read-only properties? (I'm comfortable with default getters.)
70+
71+
72+
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.)
73+
74+
75+
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.
76+
77+
TODO: TBD
78+
79+
80+
## Current State
81+
82+
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.)
83+
84+
If you are missing anything, feel free to contact me, or create a pull request.
85+
86+
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.
87+
2688

2789

2890
## Contribute
2991

30-
Thanks that you want to contribute to ScaleUpVentures/EasyObject.
92+
Thanks that you want to contribute to ScaleUpStack/EasyObject.
3193

3294
* Report any bugs or issues on the [issue tracker].
3395

@@ -46,7 +108,8 @@ Thomas Nunninger <thomas.nunninger@scaleupventures.com><br>
46108
[www.scaleupventures.com]
47109

48110

49-
111+
[scaleupstack/metadata]: https://github.com/scaleupstack/metadata
112+
[scaleupstack/reflection]: https://github.com/scaleupstack/reflection
50113
[Composer]: https://getcomposer.org
51114
[issue tracker]: https://github.com/scaleupstack/easy-object/issues
52115
[Git repository]: https://github.com/scaleupstack/easy-object

composer.json

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
{
22
"name": "scaleupstack/easy-object",
3-
"description": "Easy object handling, e.g. read-only properties, typed properties, or default constructor. No boilerplate code.",
3+
"description": "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.",
44
"type": "library",
55
"keywords": [
66
"object",
7-
"read-only property",
8-
"read-only properties",
97
"typed property",
108
"typed properties",
11-
"default constructor",
12-
"entity",
13-
"entities",
14-
"value object",
15-
"value objects",
16-
"event",
17-
"events",
9+
"union types",
10+
"default constructors",
11+
"named constructors",
12+
"default getters",
13+
"fixture setup",
1814
"no boilerplate",
1915
"boilerplate"
2016
],
@@ -38,9 +34,8 @@
3834
"require": {
3935
"php": ">=7.2.0",
4036
"scaleupstack/assert": "^1.",
41-
"scaleupstack/reflection": "dev-master",
42-
"scaleupstack/annotations": "dev-master",
43-
"scaleupstack/metadata": "dev-master"
37+
"scaleupstack/reflection": "^1.",
38+
"scaleupstack/metadata": "^1."
4439
},
4540
"require-dev": {
4641
"phpunit/phpunit": "^7."

0 commit comments

Comments
 (0)