You should never store sensitive credentials in your code. Storing configuration in the environment is one of the tenets of a twelve-factor app. Anything that is likely to change between deployment environments, such as database credentials or credentials for 3rd party services, should be extracted from the code into environment variables. Basically, a .env file is an easy way to load custom configuration variables that your application needs without having to modify .htaccess files or Apache/nginx virtual hosts. This means you won't have to edit any files outside the project, and all the environment variables are always set no matter how you run your project, Apache, Nginx, CLI, and even PHP's built-in webserver. It's WAY easier than all the other ways you know of to set environment variables, and you're going to love it!

Features

  • No editing virtual hosts in Apache or Nginx
  • No adding php_value flags to .htaccess files
  • Easy portability and sharing of required ENV values
  • Compatible with PHP's built-in web server and CLI runner
  • PHP dotenv is a PHP version of the original Ruby dotenv
  • Installation is super-easy via Composer

Project Samples

Project Activity

See All Activity >

License

BSD License

Follow PHP dotenv

PHP dotenv Web Site

You Might Also Like
MongoDB Atlas runs apps anywhere Icon
MongoDB Atlas runs apps anywhere

Deploy in 115+ regions with the modern database for every enterprise.

MongoDB Atlas gives you the freedom to build and run modern applications anywhere—across AWS, Azure, and Google Cloud. With global availability in over 115 regions, Atlas lets you deploy close to your users, meet compliance needs, and scale with confidence across any geography.
Start Free
Rate This Project
Login To Rate This Project

User Reviews

Be the first to post a review of PHP dotenv!

Additional Project Details

Programming Language

PHP

Related Categories

PHP Security Software, PHP Source Code Analysis Tool

Registered

2021-05-20