a Routing via Database Module for Emvicy PHP Framework
cd into the modules folder of your Emvicy copy; e.g.:
cd /var/www/html/modules/;git clone
git clone --branch 1.x https://github.com/emvicy/RouteDB.git RouteDB;run emvicy to init module
cd /var/www/html/; \
php emvicy;
set Route Class in your config
/**-----------------------------------------------------------------------------------------------------------------
* Route Class
* it gets called via $GLOBALS['aConfig']['MVC_ROUTE_CLASS']::init();
*/
$aConfig['MVC_ROUTE_CLASS'] = '\RouteDB\Model\Route';auto-import routes
Once the Route Class is set in your config, all routes are automatically
imported once to the database table RouteDBModelDBTableRoute on any next request.
resolving
From the moment all routes are imported, all further requests will be resolved by that database table.
force import
if you want to force an import of your current routes settings you can do this by calling the import command on cli:
php emvicy routes:dbimportor, shorthand
php emvicy rtdbiEvent::run('routedb.model.route.init.before', $oDTValue);$oDTValue->get_mValue():bool $bForceImport: force an import true|false
Event::run('routedb.model.route.init.after', $oDTValue);$oDTValue->get_mValue():bool $bForceImport: force an import true|false
Event::run('routedb.model.route.setImported.before');Event::run('routedb.model.route.setImported.after', (bool) $bPut);bool $bPut: import success true|false
Event::run('routedb.model.route.removeImported.before', $oDTValue);$oDTValue->get_mValue():string $sFile:modules/RouteDB/.imported
Event::run('routedb.model.route.removeImported.after', $bUnlink);bool $bUnlink: unlink import file success true|false
Event::run('routedb.model.route.getdataImportedIntoTableFileAbs', $oDTValue);$oDTValue->get_mValue():string $sFile:modules/RouteDB/.imported
Event::run('routedb.model.route.getCurrent.before', $oDTValue);$oDTValue->get_mValue():bool $bCacheAtRuntime: true|false
Event::run('routedb.model.route.getCurrent.after', $oDTRouteDBModelDBTableRoute);Event::run('routedb.model.route.setRoute.before', $oDTRouteDBModelDBTableRoute);Event::run('routedb.model.route.handleFallback.after', $oDTRoute);