Closed vlucas closed 10 years ago
this seems consistent with other frameworks (who tend to refer to these as ServiceProviders
rather then Plugins
but semantics aren't important... to me at least... heh).
Basically you need a way to inject the App
container into the plugin so that it can make use of its functionality. For instance, a Twig plugin could use template path from $app
for the Twig_Loader_Filesystem()
in Twig.
Would the plugin also need to create stuff back in the Bullet App
? I am trying to think of a use case where this might be needed but should part of the PluginInterface
be something that does an App::addMethod
?
I only choose Plugin
because it's a more common name that people might search for - i.e. "bullet twig plugin" vs "bullet twig service provider".
Looks like Pimple beat me to it and added a ServiceProvider to Pimple in v2.1: https://github.com/fabpot/Pimple/pull/124
I will upgrade to Pimple v2 in the next major point release.
when will this major point be do you have a eta for the milestone?
No ETA, just haven't pulled the trigger yet because going from Pimple 1.x -> 2.x will be a breaking change.
oh alright
@vlucas do you have a branch that uses Pimple v2?
edit: it appears that Pimple is now at v3, as of one month ago.
Yes indeed. I will get this updated to v3 now :)
I just tagged a version 1.4.0 release that uses Pimple 3.x. Note that this is a BREAKING CHANGE, so this will be a lesson to all of you who don't version lock your composer dependencies :)
:+1:
The more apps I create with Bullet, the more I wish certain ways I configure and use Bullet were more modular and portable across other Bullet apps. I think it's time to look at creating a more serious/structured way to register a service with Bullet. I think a class file and interface should be used so that: (1) It is easy to register and autoload, and (2) so that it has predicable methods that we can call to add the desired functionality.
Example use cases:
Example Class file
Thoughts?