Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slim 4: Change to League/Container #2623

Closed
mnavarrocarter opened this issue Apr 4, 2019 · 2 comments
Closed

Slim 4: Change to League/Container #2623

mnavarrocarter opened this issue Apr 4, 2019 · 2 comments

Comments

@mnavarrocarter
Copy link

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? 😃

@mnavarrocarter
Copy link
Author

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. :)

@l0gicgate
Copy link
Member

l0gicgate commented Apr 4, 2019

Slim 4 will not have any Container implementations as a dependency. You will provide your own. So there's no switching to be done.

See #2290

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants