Frameworks don't handle things like that. You need to code it in plug-in way.
Following scenario will allow you to code in plug-in fashion:
Lets say we have directory called plugins in the root of the site and a table in the database called plugins with following structure (id, name, enabled, path)
Now you need to create an interface for your plug-ins. This way all plug-ins will have same basic structure.
/**
* FILE: /plugins/PluginInterface.php
*
* Sample Interface
*/
interface iPlugin{
/**
* Tests if plug-in can be executed
*/
function test();
/**
* Prepared plug-in for execution
*/
function prepare();
/**
* Executes plug-in logic and returns count of somethings
*/
function execute();
}
/**
* FILE: /plugins/PluginExample.php
*
* Sample Plug-in
*/
class PluginExample implements iPlugin{
public function execute() {
}
public function prepare() {
}
public function test() {
}
}
Now you need to insert a record for the PluginExample in the database.
INSERT INTO plugins (id, name, enabled, path) VALUES (1, 'Example', 1, 'PluginExample.php')
And lastly you need somekind of controller that loads all the enabled plugins from the database (get's path) and the creates objects and executes them. Like so
function loadAndExecutePlugins() {
$query = "select * from plugins where enabled = 1";
$plugins = 'array of objects from query 1';
if ($plugins) {
foreach ($plugins as $plugin) {
//
$class = $plug->path;
include_once "/plugins/$class";
// Class is using interface, so you know what methods to call
$plug = new $class();
if ($plug->test()) {
$plug->execute();
}
}
}
}