Example #1
0
class Env
{
    public static $dev = 'gear.dev';
    public static function define()
    {
        $environment = getenv('PHINX_ENVIRONMENT');
        if (empty($environment)) {
            define('PHINX_ENVIRONMENT', 'development');
            return;
        }
        if (!in_array($environment, ['development', 'testing'])) {
            throw new \Exception('Não é seguro iniciar o sistema com o enviroment definido incorretamente: ' . $environment);
        }
        define('PHINX_ENVIRONMENT', $environment);
        return;
    }
}
Env::define();
chdir(dirname(__DIR__));
// Decline static file requests back to the PHP built-in webserver
if (php_sapi_name() === 'cli-server') {
    $path = realpath(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
    if (__FILE__ !== $path && is_file($path)) {
        return false;
    }
    unset($path);
}
// Setup autoloading
require 'init_autoloader.php';
// Run the application!
Zend\Mvc\Application::init(require 'config/application.config.php')->run();