You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think that dumping Pimple for League\Container will be a great movement for Slim 4, for many reasons.
First, I'm aware of the reason why you decided to use Pimple. It's simple and lightweight. But League/Container has some really good features Slim can benefit from.
League Container allows you to define delegate containers. These containers are kinda fallback containers. If a service is not found in the main container instance, then the delegate container is used to try to resolve the service.
Why is this useful for Slim? Well, currently, if one provides his own instance of a PSR-11 Container, then you have to manually register the Slim default services. I think that is not convienent, because the user then has to dig in the source code or documentation to check what are the required services or values for Slim to run correctly.
What League\Container would allow us to do is to define a main container, then register the Container a user passed as a delegate, and then register the Slim container (with all Slim Services already wired) as another delegate. If the user want's to override a slim setting or service, then they can do it in the container they passed to the App instance, but everything else will be able to work smoothly.
I can provide a pull request implementing the change, so you can see how it behaves in real life. I've used this strategy with a Micro Framework of my own and has worked really great.
League Container, as Slim, also has support for traditional features, like ServiceProviders, and this change will be transparent for the users.
What do you think? 😃
The text was updated successfully, but these errors were encountered:
PS: Another feature is that League Container has a ReflectionContainer that the user could use as a delegate as well. This will avoid registering every service into the container explicitly, and use some reflection magic for autowiring. Optional for those who want fast prototyping and more development speed. :)
I think that dumping Pimple for League\Container will be a great movement for Slim 4, for many reasons.
First, I'm aware of the reason why you decided to use Pimple. It's simple and lightweight. But League/Container has some really good features Slim can benefit from.
League Container allows you to define delegate containers. These containers are kinda fallback containers. If a service is not found in the main container instance, then the delegate container is used to try to resolve the service.
Why is this useful for Slim? Well, currently, if one provides his own instance of a PSR-11 Container, then you have to manually register the Slim default services. I think that is not convienent, because the user then has to dig in the source code or documentation to check what are the required services or values for Slim to run correctly.
What League\Container would allow us to do is to define a main container, then register the Container a user passed as a delegate, and then register the Slim container (with all Slim Services already wired) as another delegate. If the user want's to override a slim setting or service, then they can do it in the container they passed to the App instance, but everything else will be able to work smoothly.
I can provide a pull request implementing the change, so you can see how it behaves in real life. I've used this strategy with a Micro Framework of my own and has worked really great.
League Container, as Slim, also has support for traditional features, like ServiceProviders, and this change will be transparent for the users.
What do you think? 😃
The text was updated successfully, but these errors were encountered: