Esempio n. 1
0
        return $cache;
    });
    /**
     * Main logger file
     */
    $di->set('logger', function () {
        return new FileLogger(__DIR__ . '/../var/logs/' . date('Y-m-d') . '.log');
    }, true);
    /**
     * Error handler
     */
    set_error_handler(function ($errno, $errstr, $errfile, $errline) use($di) {
        if (!(error_reporting() & $errno)) {
            return;
        }
        $di->getFlash()->error($errstr);
        $di->getLogger()->log($errstr . ' ' . $errfile . ':' . $errline, Logger::ERROR);
        return true;
    });
    /**
     * Handle the request
     */
    $application = new Application();
    $application->setDI($di);
    /**
     * Register application modules
     */
    $application->registerModules(require __DIR__ . '/../common/config/modules.php');
    echo $application->handle()->getContent();
} catch (Exception $e) {
    echo $e->getMessage();