Okay it's going to be a slight departure from our planned next step on our API because I realised we need to store our database credentials somewhere and it seemed like an ideal opportunity to try out the Symfony dotenv component. This component reads values from a specified config file into environment vars. Using environmental vars helps separate credentials from code and keeps them out of a source control system. But why do you need a component to help with this? Well it's an extra convenience in dev and staging setups. It means theres no need to add any extra config outside your project and it adds improved portability (this method works with Apache, Nginx, PHP web server etc.). You shouldn't be using this component or an
.env config file on production systems. Anyway, it's really simple to use, let's set it up.