zendframework / zend-expressive-skeleton

Begin developing PSR-7 middleware applications in seconds!
BSD 3-Clause "New" or "Revised" License
136 stars 90 forks source link

Use a different "config" key #50

Closed RalfEggert closed 8 years ago

RalfEggert commented 8 years ago

Currently, the container configuration is just placed under the fixed config key like here:

https://github.com/zendframework/zend-expressive-skeleton/blob/master/src/ExpressiveInstaller/Resources/config/container-zend-servicemanager.php#L13

This key is hard coded. Wouldn't it be better if we could use a class name or a constant here? Something like Zend\Expressive\Container\Config::class or something similar.

Or is that a bad idea?

geerteltink commented 8 years ago

If you go that road, i think you actually need to make that class. Otherwise you have to create a fake class and end up with something like 'Zend\Expressive\FinalHandler': https://github.com/zendframework/zend-expressive-skeleton/blob/master/src/ExpressiveInstaller/Resources/config/templates-plates.php#L6-L7

In stead of a fake class, I rather stick to config since it's easy, short and is exactly what it says it is.

codeliner commented 8 years ago

Please don't change the "config" key! Our factories rely on the "convention" that the application factory is available as service id "config" in the container. Ok, we could define an alias but "config" is available in ZF2 and therefor should be available in expressive too.

RalfEggert commented 8 years ago

It was just an idea. Could only be solved with a class constant that uses config as the value. But I understand that it is such an elementary change that it is hard to implement now. Maybe an idea for ZF4.

I will close this.