} );*/ /** * Main logger file */ $di->set('logger', function () { return new \Phalcon\Logger\Adapter\File(__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, Phalcon\Logger::ERROR); return true; }); /** * Encryption service */ $di->set('crypt', function () use($config) { $crypt = new Crypt(); $crypt->setKey('1234'); return $crypt; }); /** * Handle the request */ $application = new \Phalcon\Mvc\Application();