How to set up multi-env in Craft 3 with .env files?
These are the two approaches I usually choose from:

Option 1: the 'default' Craft 3 way


Create a .env file for every environment you create, and add it to your .gitignore file (if it's not yet in it). In this file, you put all environment-specific details;
Craft, by default, will recognize and use those details.
In your Craft config files, you can use the ENVIRONMENT as defined in your .env file to adjust the settings for one specific environment. So, the config that applies all the time is set in an array with the key '*', and the config that's specifically for the dev environment, is in the array that has the 'dev' key (If you use the default general config file)


Option 2: the .env.php way

One of the reasons this approach exists, is that the makers of PHP dotenv (used in option 1) 'warn against using it in production' (as quoted from the README of option 2). The method as linked in the title uses a PHP file and some minor alterations to your config and index files to let you maintain a multi environment build.