-
Notifications
You must be signed in to change notification settings - Fork 195
Don't recommend pimple-interop #129
Comments
It doesn't look like v3 has container-interop support; is there a project that provides that? (Also, completely missed that pimple-interop was using v1!!!!) |
Why not send a PR to make it compatible then ? |
First of all, I actually had a class in the expressive installer that made it work on a very basic level. I don't know the current status of the PSR, all I know is it needs a get and has function. This is easily done: https://xtreamwayz.github.io/blog/pimple-3-container-interop/. But then again, after that post I've seen stuff about a delegator look up and that wouldn't work with my concept. That's why I removed it a few days ago. Secondly, after some research I found out they are not interested until a real PSR is out: https://github.com/silexphp/Pimple/issues/162. |
https://github.com/silexphp/Pimple/issues/162 is a year old, maybe their POV of view has changed since (just hoping :) ). Regarding making a Pimple 3 version that's compatible with container-interop, see that PR: moufmouf/pimple-interop#1 (comment) The conclusion was we need to rewrite Pimple. It doesn't necessarily mean forking and creating a new package, it could be simply extending the base Pimple class. But it probably involves re-implementing all the methods. (I'm a little late here, sorry for reviving the thread) |
Hi guys, sorry to butt in if this isn't relevant, but would a project like https://github.com/Sam-Burns/pimple3-containerinterop be of any interest to you? \cc @mnapoli |
Yes, yes it would, @Sam-Burns . I think it can even be a drop-in replacement for what we have in place already. Would you be willing to do a PR against zendframework/zend-expressive-skeleton to change the dependency used for Pimple? I can then do some integration testing to validate. If it looks good, I'll also update the docs in this repo to reflect the change in dependencies. |
@weierophinney Certainly willing to, yes. Will make sure you're on \cc when the PR is ready. |
@Sam-Burns Thanks! |
Ref. #228 |
Correct me if I'm wrong, but it looks like the pimple3-containerinterop wraps the container in a custom container class. This way it looses the flexibility of pimple, especially when building the container. Although I like Pimple 3 support, I'd rather see something that stays closer to Pimple. Maybe revert something like this: zendframework/zend-expressive-skeleton@b4a0923 |
This one is actually extending pimple: https://github.com/snapshotpl/pimple-interop |
I've been reviewing the approaches in the implementations of both @Sam-Burns and @snapshotpl, and each has issues: As you note, Sam's doesn't give direct access to the underlying container, which means you lose flexibility around setting up the container. That can be mitigated in a couple of ways:
My principal remaining concerns is that the interop instance is primarily a proxy, which means overhead when you access it (2X method calls in most cases). With regards to the work by @snapshotpl, I like the simplicity; all it does is extend the class and add the requisite
Ideally, what I'd like to see is a version that:
The options we have for that are:
The first is the only real solution, as far as I'm concerned; I'd really like to avoid NIH syndrome. The real question I have at this time is whether we should try and accomplish this for the initial stable release. Thoughts? |
@weierophinney How about this: https://github.com/xtreamwayz/pimple-container-interop It also tries to implement the delegate lookup feature, although I'm not sure if it's implemented correctly. |
FWiW, Slim extends Pimple to add the container-interop methods: https://github.com/slimphp/Slim/blob/3.x/Slim/Container.php#L247-L282 It also does other things(!), but I agree that extending Pimple is the right approach. |
@akrabat That's basically what I have without the delegate feature: https://github.com/xtreamwayz/pimple-container-interop |
@xtreamwayz Yeah - just looked at your code. It seems fine other than it's in the wrong root namespace :) |
@akrabat What should be the right one? EDIT: If I keep it in that namespace and rename the Container to PimpleInterop, we can use it with only few changes. |
@xtreamwayz : How about |
Can do :) |
No problem guys, I can improve my repo today |
@weierophinney Just out of interest, what is your concern about using the adapter pattern when integrating a third-party library? It's something I would always do, given the opportunity. If it's about accessing the container directly to set things, maybe the The way the docs recommend Pimple be configured, at present, is to use the ArrayAccess to set variables. This will clearly work with Pimple 4+, as long as it still implements I still think using the adapter pattern as standard with third-party libraries is good software architecture; but would you feel better about it if the adapter had a EDIT: This is the passthrough I was referring to. Documenting it now. |
mouf/pimple-interop
is based on Pimple 1. The Pimple project is currently on version 3.0.2. We probably don't want to be recommending Pimple 1.The text was updated successfully, but these errors were encountered: