I would like to build a modular based PHP project. Every module can be enabled / disabled from an admin tool, and every module can be dependent on other modules. Every module can declare its dependencies in a simple manifest file something like dependsOn: A, B, C where A, B and C are other modules that needs to be enabled.
My question is if there is a good practice or ready / made solution to resolve the dependency graph, for this kind of modular system?
The key thing is I would like to check the dependencies when a module is getting enabled and fire a message to the user to enable the dependent modules as well. By enabling the dependent modules they can be dependent on other modules too and so on.
Also it would be great if the solution can find cycles in the graph, like A is dependent on B, B is dependent on C, but C is dependent on A.
Best Regards,
Feri
You might want to look at Composer – http://getcomposer.org/ – I think it meets some of your requirements, but you’ll have to find a good way to hook into its functionality when modules are enabled at runtime.