rdlowrey / auryn

IoC Dependency Injector
MIT License
722 stars 65 forks source link

Adding new definitions on runtime #147

Closed dsazup closed 7 years ago

dsazup commented 8 years ago

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?

kelunik commented 8 years ago

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.

jm42 commented 8 years ago

You could do something like https://github.com/elazar/auryn-configuration or https://github.com/equip/config.

dsazup commented 8 years ago

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

@jm42 thanks, I will have a look.

kelunik commented 7 years ago

Can I close this issue?

dsazup commented 7 years ago

Sure this can be closed.