Most frameworks don't support this out of the box. You need a custom loader. Here is how you implement the hierarchy in different ecosystems.
Here's an example .env.default.local file: .env.default.local
The story of .env.default.local is a tale of a developer named Alex who wanted to keep their project’s configuration organized while working with a team. The Problem: The "Works on My Machine" Curse Most frameworks don't support this out of the box