-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Remove container #2290
Remove container #2290
Conversation
It makes complete sense to me. 👍 |
That's good news!
I'm not sure I understand this part: can "core" services of Slim still be overridden? Is Slim doing something like |
I'd suggest pinning to Pimple 3.1 in dev at a minimum, to try and fix the Travis warning. |
The |
@akrabat OK so a question that's maybe a bit out of scope here but just to get it right: when using a container it might make sense to let the container create the "Application" class (the container would call |
@mnapoli Yes. If you need to customise the App's dependencies, then letting the app, then letting the container create the |
Awesome great then! |
|
@akrabat this PR needs to be rebased. |
It's not used as process() catches everything.
Container is now completely optional. App now creates its own request and response in `run()` and the rest of the objects in `DefaultServicesProvider` were already defined within `App`. Also removed the magic `__call` method on `App` that allows access to the container as there's no need for it. Note that Pimple is a dev dependency for testing routing, `CallableResolver` and `DeferredCallable`. AppTest has also been tidied a little. Closes #2288
Rebased to tip of 4.x |
These were only being used by Container which is now gone.
Yes, you're right @bnf. I've removed them. |
How can we now use dependency injection for tools like Monolog? |
Slim 4 accepts provision of your own PSR-11 compatible container and will use it to resolve actions, etc. Hence you now have more flexibility and can bring your choice of container to your Slim project. |
@akrabat So I could set my own container, include dependencies (like Monolog) into it, and then access dependencies with This could be in the documentation for v4. |
Technically, you'd have to pass your container into your action's constructor to have a Docs for v4 are barely started. |
Container
is now completely optional. App now creates its own request and response inrun()
and the rest of the objects inDefaultServicesProvider
were already defined withinApp
.Also removed the magic
__call
method onApp
that allows access to the container as there's no need for it.Note that Pimple is a dev dependency for testing routing,
CallableResolver
andDeferredCallable
.AppTest has also been tidied a little.