title: Composer PSR-4 for application files
body: <p>I am new to using composer and have created a list of required projects in my composer.json file. I can use them within my index.php bootstrap file fine.</p>
  
  <p>However I want to also be able to autoload my own project files outside of the vendor folder using composers autoloader. My folder structure is as follows:</p>
  
  <pre><code>vendor/
  project/
     Project.php
  index.php
  composer.json
  </code></pre>
  
  <p><strong>index.php</strong></p>
  
  <pre><code>&lt;?php
  
  require 'vendor/autoload.php';
  
  new \Project\Project;
  </code></pre>
  
  <p><strong>Project.php</strong></p>
  
  <pre><code>&lt;?php
  
  namespace Project;
  
  class Project {
  }
  </code></pre>
  
  <p><strong>composer.json</strong></p>
  
  <pre><code>{
      "autoload": {
          "psr-4": {
              "Project\\": "project"
          }
      }
  }
  </code></pre>
  
  <p>This keeps coming up with the following error:</p>
  
  <pre><code>Fatal error: Class 'Product\Product' not found in index.php on line 5
  </code></pre>
  
  <p>What am i doing wrong? Or can I not use composers autoload to load my application files?</p>
  
  <p><strong>Edit</strong>
  Turns out I needed to run <code>composer dump-auto -o</code> to refresh the changes I made to the <code>composer.json</code> file. Credit to @Quasduck who posted in the comments.</p>