title: Load a .env file with PHP
body: <p>I'm currently coding on a pure PHP project and I need to load an .env file to get some variables. After a bit of searching I turned to the vlucas/phpdotenv plugin (That I imported with Composer), but I can't import it! Do I have to use an MVC model for this to work?</p>
  <p>index.php:</p>
  <pre><code>&lt;?php
      $dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
      $dotenv-&gt;load();
  </code></pre>
  <p>bdd.php:</p>
  <pre><code>&lt;?php
  
      function DBConnect() {
          $user = getenv(&quot;DB_USER&quot;);
          $pass = $_ENV[&quot;DB_PASSWORD&quot;];
  </code></pre>
  <p><a href="https://i.stack.imgur.com/xhrT0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xhrT0.png" alt="" /></a></p>