rdlowrey/auryn

Adding new definitions on runtime

Closed this issue · 5 comments

Hi,
First of all its a question rather than an issue. Sorry if the title does not make sense, I'll try to explain. Basically I'm using this DIC for a pretty big project and its amazing, it works really well.

At the moment I'm using just one bootstrap file where I defined all the dependencies. It executes the front controller and it all goes from here.
What I'm trying to do now is to introduce plugins system. Similar to service providers in pimple. How would one go about doing this? What I was thinking, is to first of all do $injector->share($injector) so it is a singleton. And then basically once the plugin is loaded, add the dependencies to injector. Any ideas what would be the best way to do this?

Have a list of plugins in the bootstrap file and just add the definitions to the injector. You shouldn't use the injector as service locator and thus not share it.

@kelunik good point. Thats not something I want to do.

@jm42 thanks, I will have a look.

Can I close this issue?

Sure this can be closed.