 implementing apis apis are a form of plugins that are tightly associated with a module instead of a module providing any number of plugins each module provides only one file for an api and this file can contain hooks that the module should invoke modules support this api by implementing hookctoolspluginapi module api if they support the api they return a packet of data function mymodulectoolspluginapi module api if module some module api some api return array version the minimum api version this system supports if this api version is incompatible then the inc file will not be loaded path where to find the file optional if not specified it will be the module s directory file an alternative version of the filename if not specified it will be module apiinc this implementation must be in the module file modules utilizing this can invole ctoolspluginapiinclude in order to ensure all modules that support the api will have their files loaded as necessary it s usually easiest to create a small helper function like this define mymoduleminimumversion 1 define mymoduleversion 1 function mymoduleincludeapi ctoolsinclude plugins return ctoolspluginapiinclude mymodule myapi mymoduleminimumversion mymoduleversion using a define will ensure your use of version numbers is consistent and easy to update when you make api changes you can then use the usual moduleinvoke type commands mymoduleincludeapi moduleinvoke myhook data if you need to pass references this construct is standard foreach mymoduleincludeapi as module info function module hookname just because they implement the api and include a file does not guarantee they implemented a hook function if functionexists function continue typically arraymerge is used below if data is returned result function data1 data2 data3 todo there needs to be a way to check api version without including anything as a module may simply provide normal plugins and versioning could still matter  