title: How can I autoload a custom class in Laravel 5.1?
body: <p>I've created a <code>library</code> folder within the <code>app</code> folder to add my own classes.</p>
  
  <p><a href="https://i.stack.imgur.com/hD5ze.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hD5ze.png" alt="enter image description here"></a></p>
  
  <p>This is the content of the file <code>app/library/helper.php</code>:</p>
  
  <pre><code>&lt;?php
  
  namespace Library;
  
  class MyHelper
  {
      public function v($arr)
      {
          var_dump($arr);
      }
  }
  </code></pre>
  
  <p>I added the namespace to <code>composer.json</code>:</p>
  
  <p><a href="https://i.stack.imgur.com/jqIiw.png" rel="noreferrer"><img src="https://i.stack.imgur.com/jqIiw.png" alt="enter image description here"></a></p>
  
  <p>and then I ran </p>
  
  <pre><code>$ composer dump-autoload
  </code></pre>
  
  <p>but it does not seem to have any effects. </p>
  
  <p>The files</p>
  
  <ul>
  <li><code>vendor/composer/autoload_psr4.php</code></li>
  <li><code>vendor/composer/autoload_classmap.php</code></li>
  </ul>
  
  <p>did not change.</p>
  
  <p>If I try to create an instance of <code>MyHelper</code>, Laravel reports the following error:</p>
  
  <p><a href="https://i.stack.imgur.com/sy7t4.png" rel="noreferrer"><img src="https://i.stack.imgur.com/sy7t4.png" alt="enter image description here"></a></p>
  
  <p>I'm not sure what I am doing wrong.</p>