<?php /** * Project: zaralab * Filename: console.php * * @author Miroslav Yovchev <*****@*****.**> * @since 31.10.15 */ require __DIR__ . '/../vendor/autoload.php'; use Symfony\Component\Console\Input\ArgvInput; use Zaralab\Framework\Console\App; use Zaralab\Framework\Config; // Override DEBUG/ENV $input = new ArgvInput(); $env = $input->getParameterOption(array('--env', '-e'), null); $debug = $env === null ? null : !$input->hasParameterOption(array('--no-debug', '')) && $env != 'prod'; $container = Config::containerFactory(__DIR__, $env, $debug); // Set current directory to application root so we can find root config files chdir(__DIR__ . '/..'); $app = new App($container); $app->setCatchExceptions(true); // Set up DIC require __DIR__ . '/dependencies.php'; $app->run($input);
<?php if (PHP_SAPI == 'cli-server') { // To help the built-in PHP dev server, check if the request was actually for // something which should probably be served as a static file $file = __DIR__ . $_SERVER['REQUEST_URI']; if (is_file($file)) { return false; } } if (isset($_SERVER['HTTP_CLIENT_IP']) || isset($_SERVER['HTTP_X_FORWARDED_FOR']) || !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) { header('HTTP/1.0 403 Forbidden'); exit('You are not allowed to access this file.'); } require __DIR__ . '/../../vendor/autoload.php'; session_start(); // Container $container = \Zaralab\Framework\Config::containerFactory(__DIR__ . '/../../app', 'test', false); // Instantiate the app $app = new \Slim\App($container); // Set up dependencies require __DIR__ . '/../../app/dependencies.php'; // Register middleware require __DIR__ . '/../../app/middleware.php'; // Register routes require __DIR__ . '/../../app/routes.php'; // Run! $app->run();