Skip to content

Instantly share code, notes, and snippets.

@AydinHassan
Last active August 29, 2015 14:01
Show Gist options
  • Save AydinHassan/7e2e9839cf9cb68931e8 to your computer and use it in GitHub Desktop.
Save AydinHassan/7e2e9839cf9cb68931e8 to your computer and use it in GitHub Desktop.
ZF2 Module Installer
I want the ability to be able to "install" modules which require installing.
If they have not been installed, then they should not be loaded.
Imagine there is one module in a ZF2 Skeleton App. Named "Hub".
It has an "install" cli route, which loops through all loaded modules.
If they implement "InstallableInterface" they will provide some install service.
The "install" command will run each of these
services "install" method.
One example (my use case) is that I need to loop thorugh each user and create a 'user_flex_settings' row for them.
This row is only required when the module "JhFlexiTime" is loaded.
If the install command has not been run, I want to disable loading those modules which have not been installed yet.
The modules are recorded as installed using a module_status table, so after installing a module,
a row should be inserted
into that table.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment