cspray / annotated-container

Dependency Injection framework to configure a PSR-11 Container with Attributes!
MIT License
39 stars 1 forks source link

Allow functional API to define an Attribute implementation #377

Open cspray opened 5 months ago

cspray commented 5 months ago

In 2.x the functional API does not allow defining an Attribute on a Definition. Intuitively, this might make sense; after all, you aren't adding the Definition with an Attribute so there's nothing to supply. However, this does not take into consideration the possibility of custom Attributes. If these Attributes hold metadata, for example in the PSR-15 microframework demo the #[Controller('GET', '/path')] has routing data associated with it. If you were to use the functional API there'd be no way to provide this information.

cspray commented 5 months ago

We need to give this much more thought. While the provided use case may be valid there are repercussions to how the functional API work. It would be better to wait for this feature until somebody has actually used a DefinitionProvider centric approach to wiring their Container while not making some use of custom attributes.