title: Why am I getting error Class not found even if the class does exist and is correctly namespaced
body: <p>I am trying to develop a package with will be required by some of our applications. However, I am unable to test the package when I require it using composer inside an application.</p>
  <p>The package has the following composer.json:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;name&quot;: &quot;armcanada/target-horaire&quot;,
      &quot;type&quot;: &quot;library&quot;,
      &quot;license&quot;: &quot;MIT&quot;,
      &quot;description&quot;: &quot;&quot;,
      &quot;authors&quot;: [
          {
              &quot;name&quot;: &quot;Anthony Duhaime&quot;,
              &quot;email&quot;: &quot;aduhaime@armcanada.ca&quot;
          }
      ],
      &quot;require&quot;: {},
      &quot;autoload&quot;: {
          &quot;psr-4&quot;: {
              &quot;Armcanada\\TargetHoraire\\&quot;: &quot;src/&quot;
          }
      },
      &quot;minimum-stability&quot;: &quot;dev&quot;
  }
  
  </code></pre>
  <p>The package has the following directory structure and has the following testing class:
  <a href="https://i.stack.imgur.com/1QfVD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1QfVD.png" alt="Directory structure and test class" /></a></p>
  <p>The package is require in another application in the composer.json:</p>
  <pre class="lang-json prettyprint-override"><code>&quot;require&quot;: {
      &quot;armcanada/target-horaire&quot;: &quot;dev-master&quot;
  }
  &quot;repositories&quot;: [
          {
              &quot;type&quot;: &quot;path&quot;,
              &quot;url&quot;: &quot;../target-horaire&quot;
          }
      ]
  </code></pre>
  <p>Finally, I am importing the class and calling the <code>test()</code> method:</p>
  <pre class="lang-php prettyprint-override"><code>use Armcanada\TargetHoraire\Models\Timeline;
  
  ...
  
  dd((new Timeline())-&gt;test());
  
  </code></pre>
  <p>It result with the following error:
  <code>&quot;Class 'Armcanada\TargetHoraire\Models\Timeline' not found&quot;</code></p>
  <p>I have tried to <code>composer dumpautoload</code> in both the application and the package, still has no effect.</p>
  <p>I also tried to delete the vendor folder and the package-lock.json then run <code>composer install</code>, I am now getting the error:
  <code>include(/app/vendor/composer/../armcanada/target-horaire/src/Models/Timeline.php): failed to open stream: No such file or directory</code>. However, the file does exist:
  <a href="https://i.stack.imgur.com/KnbLr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KnbLr.png" alt="enter image description here" /></a></p>
  <p>What am I doing wrong?</p>