Hi Michael, thanks for your response. Registry is a great package and should definitely get more attention as primary tool for hierarchical key/value or configuration storage. But it's only for basic configurations. It's not possible, at least not in a convenient way, to define the behavior of an object. To define some sort of behavior most other frameworks are using annotations, but (and please mind that this is only an opinion) using annotations seems not good enough for me. PHP is an interpreted language and should not be forced to be compiled.
Let's take forms as example (because its so convenient): Today we just use some sort of meta data to create a form, the format doesn't matter as its always "external" data. Using external meta data provides a simple solution to define fields in a more or less restricted way. But what if we see a form not just as a collection of field but as a real and active object. A form contains more than simple field definition. Hence, even fields are not that simple. each field is an object which behavior may vary.
The easiest solution would be to use some sort of hooks/events or even AOP, but those solutions have one downside in common: They separating thing. Most of the time this is exactly what we want, but sometimes it might be better to have atomic element which can be shared, transfered and versioned.
A plastic example:
Most applications will have a graphic user interface where they manage persistent data (like articles, categories, etc.). If we see a form as an atomic element, there could be a versioned basic form with required fields, some behavioral information like which action to call or additional actions, and more. Not only that it could be extended by other forms, but also be forked to fit in another context. We were not forced to write the same code (create meta data, create form, create the markup, create logic like validations or other actions) all over again.
Imagine their would be a class "MyAppItemForm" which has all informations it needs for doing its job. It's extactly what some frameworks are doing with annotations. They write annotations and generate a "real class" which will be cached. But as i mentioned: Annotations doesn't seem right to me.
I don't know how else i could describe it. And of course i don't have a solution, that's the reason i thought it might be something where we can share our minds.