Welcome Guest, Not a member yet? Register   Sign In
Location and Name of CI v4 .env File

Hi Everyone,

I am diving into CI v4 after using CI v3 and v2.  Learning and liking it the more I use it.  Keep up the great work CI dev team.

I am using XAMPP with virtual hosts for local development.  I have the CI public folder in the XAMPP htdocs directory and both the application and system directories outside the public directory, and renamed to suit the project.  Configuration paths are all set and sites work.

If CI expects .env to be named as such, and in the same directory as the application and system folders, I can only have one .env file 'active' at a time while developing on localhost.

To be able to develop across multiple projects at the same, the only way I see of referencing the .env file is modifying its name and replacing / extending the System's Config\DotEnv class and passing a new name in the constructor.

PHP Code:
public function __construct(string $pathstring $file '.env_project_name')
$this->path rtrim($pathDIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR $file;

Is the best way to go about it?

Messages In This Thread
Location and Name of CI v4 .env File - by Mr Lister - 11-10-2020, 09:33 PM

Theme © iAndrew 2016 - Forum software by © MyBB