PHP code example of slender / module-loader
1. Go to this page and download the library: Download slender/module-loader library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
slender / module-loader example snippets
use \Slender\ModuleLoader\ModuleLoader;
use \Slender\ModuleLoader\ModuleInterface;
$app = new \Slim\App();
/**
* An example module class
*/
class MyModule implements ModuleInterface
{
public function invokeModule( \Slim\App $slim )
{
$slim->get('/foo',function(){
/* ... */
});
}
}
// Create the module loader instance
$moduleManager = new SimpleModuleLoader();
// Try to load the module
$moduleManager->loadModule('\Acme\Example\MyModule', $slim);