Beispiel #1
0
    require_once __DIR__ . '/Exceptions/Debug/BaseShutdown.php';
    //initilize native session
    session_start();
    //get the composer autoloader.php file
    require_once __DIR__ . '/../vendor/autoload.php';
    //load the defined constants
    require_once __DIR__ . '/../application/constants.php';
    //load system configuration settings into array
    $config = (require_once __DIR__ . '/../config/config.php');
    //load system database settings into array
    $database = (require_once __DIR__ . '/../config/database.php');
    //include the initializatoin file
    require_once __DIR__ . '/initialize.php';
    //set the class aliases, so they are available to our closure objects
    //loop through aliases autoloading
    foreach (Drivers\Registry::getConfig()['aliases'] as $aliasNamespace => $aliasName) {
        //register and lazy autoload the aliases(class)
        class_alias($aliasNamespace, $aliasName);
    }
    //get closure object instance to launch application
    $start = (require_once __DIR__ . '/start.php');
    //lauch application instance
    $start();
} catch (Exception $e) {
    $error = <<<ERROR
\t<!DOCTYPE html>
\t<html>
\t<head>
\t    <meta charset="utf-8">
\t    <meta http-equiv="X-UA-Compatible" content="IE=edge">
\t    <meta name="viewport" content="width=device-width, initial-scale=1">
Beispiel #2
0
return function () use($config) {
    //Load the defined routes file into array
    try {
        //check of the routes configuration file exists
        if (!file_exists(__DIR__ . '/../application/routes.php')) {
            throw new Drivers\Routes\RouteException("Drivers\\Routes\\RouteException : The defined routes.php file cannot be found! Please restore if you deleted");
        }
        //get the defined routes
        $definedRoutes = (include __DIR__ . '/../application/routes.php');
    } catch (Drivers\Routes\RouteException $ExceptionObjectInstance) {
        //display the error message to the browser
        $ExceptionObjectInstance->errorShow();
    }
    //create an instance of the UrlParser Class,
    $UrlParserObjectInstance = new Drivers\Utilities\UrlParser(Drivers\Registry::getUrl(), Drivers\Registry::getConfig()['url_component_separator']);
    //and set controller, method and request parameter
    $UrlParserObjectInstance->setController()->setMethod()->setParameters();
    //create an instance of the route parser class
    $RouteParserObject = new Drivers\Routes\RouteParser(Drivers\Registry::getUrl(), $definedRoutes, $UrlParserObjectInstance);
    //check if there is infered controller from url string
    if ($UrlParserObjectInstance->getController() !== null) {
        //check if there is a defined route matched
        if ($RouteParserObject->matchRoute()) {
            //if there is a defined route, set the controller, method and parameter properties
            $RouteParserObject->setController()->setMethod()->setParameters();
            //set the value of the controller
            $controller = $RouteParserObject->getController();
            //set the value of the method
            ($action = $RouteParserObject->getMethod()) || ($action = $config['default']['action']);
        } else {