.env File

A .env file is com­mon­ly used in web devel­op­ment, includ­ing Craft CMS projects, to store envi­ron­ment-spe­cif­ic con­fig­u­ra­tion vari­ables. This includes sen­si­tive infor­ma­tion like data­base cre­den­tials and API keys, keep­ing them sep­a­rate from the appli­ca­tion code and out of ver­sion control.

The con­fig­u­ra­tion in an .env file stored as key-val­ue pairs that makes it eas­i­er to man­age con­fig­u­ra­tion set­tings in dif­fer­ent envri­on­ments. The .env file is nev­er added to a Git repos­i­to­ry or stored any­where that is avail­able to a wider team or pub­lic because it often con­tains secret keys and pass­word and is environment-specific.

Here’s an exam­ple of a .env file