codeigniter - is this approach good to define environment with dotenv - PHP -
i'm using phpdotent , defined environment in end of index.php
in codeigniter. works fine , wonder if approach good? or not
require_once basepath . 'dotenv/autoloader.php'; $dotenv = new dotenv\dotenv(__dir__); $dotenv->load(); $en = getenv('app_env'); switch ($en) { case 'development': define('environment', 'development'); error_reporting(e_all); break; case 'testing': case 'production': define('environment', 'production'); error_reporting(0); break; default: exit('the application environment not set correctly.'); }
Comments
Post a Comment