In the PHP world, this usually mean a .env file in the root of your project. Most modern frameworks, such as Laravel and Symfony, come with built in support for a .env file.

In some cases, you might simply prefer to use a more standard environment file over the way in which configuration is currently provided by your project.

If not, make sure you include vendor/autoload.php in any file you wish to access your .env file variables from. You can now create a .env file in the root of your project, alongside your composer.json file and populate it as follows.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners