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

Stand alone plugin manager replacement #123

Closed
wants to merge 1 commit into from

Conversation

gsteel
Copy link
Member

@gsteel gsteel commented Jan 14, 2022

Q A
Documentation not-yet
BC Break yes
New Feature yes
RFC yes

Description

Further to discussion in #121, this is an initial draft (Without docs or tests) for a replacement plugin manager enabling the removal of the hard dependency on Laminas Service Manager.

The expectation is that view helpers are configured as a map of ['alias' => 'container-id-or-class-string']. An attempt is made to new class-strings not present in the container and whatever comes out needs to be callable

Questions

  • would it be advantageous to allow closures|callables as values in the map?
  • would it be better to return Closure and use closure from callable before returning?
  • should runtime modification of the configured helpers be allowed?

@gsteel
Copy link
Member Author

gsteel commented Jan 27, 2022

Paging @Ocramius and @froschdesign for review/discussion 🙏

If this looks like a feasible approach, I'll do some more work on it… It'd be great if we could get #118 merge so that CI stands a chance too :)

@gsteel gsteel force-pushed the standalone-plugin-manager branch from 9b41f03 to 3f014d4 Compare January 31, 2022 21:37
@boesing
Copy link
Member

boesing commented Feb 9, 2022

Just curious about this:

Do we plan to remove servicemanager dependency in all laminas components?

@gsteel
Copy link
Member Author

gsteel commented Feb 9, 2022

I personally think that making "things" more vendor agnostic might mean that laminas-view specifically might have broader appeal. In my typical uses of the lib, I'd still be using Service Manager, but I think it's generally a good thing that all you need is any Psr-11 container wired up… I'd appreciate further discussion on whether this pull is feasible/likely to be merged - I'll put in some more effort if so.

@froschdesign
Copy link
Member

Do we plan to remove servicemanager dependency in all laminas components?

I think we should ask @weierophinney because the idea is based on his work on laminas-feed.

@Ocramius
Copy link
Member

Note: if we plan to get rid of plugin managers from laminas/laminas-servicemanager, then let's please not re-implement a plugin manager per-component.

That was what we had with Zend_Loader and all that stuff in the past: it's a worse solution, IMO.

Yes, having the dependency here is a pain, but the abstraction should be well defined, and @gsteel accumulated loads of experience in how to make type-safe plugin-manager abstractions.

Having a PSR-11 dependency (that provides the plugins) would certainly suffice, if well-typed, but rewriting it everywhere feels meh.

@boesing
Copy link
Member

boesing commented Jul 19, 2022

TBH: I would be fine if the project depends on psr/container directly.
Much more smoother upgrade path.
Having no interface at all (as in here) does not feel like an improvement tho.

@gsteel
Copy link
Member Author

gsteel commented Jul 19, 2022

Is it feasible to look at AbstractPluginManager, remove its inheritance tree and make it depend on a PSR container in a final constructor? (Obvs in a major)… That way we can have plugin managers in components that only need to add the generics and perhaps validate instances on the way out rather than on the way in?

@weierophinney
Copy link
Member

TBH: I would be fine if the project depends on psr/container directly.
Much more smoother upgrade path.

There's a pretty huge BC break if we do that, however: since the release of ZF 2.0, we've been able to provide view_helpers configuration using SM configuration semantics. If we provide a standalone PSR-11 implementation and/or switch to having it jsut consume PSR-11 without providing an implementation, we'd need to ensure there's an additional package that provides a laminas-servicemanager-backed version for use with each of Laminas MVC and Mezzio to ensure existing configuration continues to work. And we'd need to depend on that package by default until a new major, at the minimum, to prevent breakage in existing applications. Ideally, we should likely keep it for another entire major cycle to provide ample time for users to migrate.

Yes, moving to straight-up PSR-11 would be easiest in terms of upgrade path and interop, but it comes at the expense of our own ecosystem.

@gsteel
Copy link
Member Author

gsteel commented Jul 20, 2022

Further to my comment, I had something like this in mind: https://gist.github.com/gsteel/eb0cff849f57bdda5aee98bfd601af66

@gsteel
Copy link
Member Author

gsteel commented Oct 11, 2022

I'm killing this PR - In summary I think most feel it's lacking much advantage over the current plugin manager.

@gsteel gsteel closed this Oct 11, 2022
@gsteel gsteel deleted the standalone-plugin-manager branch October 11, 2022 18:42
@Ocramius Ocramius removed this from the 3.0.0 milestone Oct 11, 2022
@Ocramius
Copy link
Member

@gsteel remember to adjust milestone/labels, or else it still lands in release notes 😬

@gsteel
Copy link
Member Author

gsteel commented Oct 11, 2022

Sorry @Ocramius - I'll remember next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement RFC Won't Fix This will not be worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants