title: How to add my own custom class in Laravel 5?
body: <p>Ok, in laravel 4, if I want to add my own custom class, eg : library\myFunction.php then I do the following steps : </p>
  
  <ol>
  <li>add "<strong>myFunctions.php</strong>" into <strong><em>app/library/myFunctiosn.php</em></strong></li>
  <li>at <strong><em>app/start/global.php</em></strong> , within <strong><em>ClassLoader::addDirectories(array(</em></strong> , I add <strong><em>app_path().'/library',</em></strong></li>
  <li>And to call it within my blade view, I add the following codes</li>
  </ol>
  
  <pre class="lang-html prettyprint-override"><code>&lt;?php
    $FmyFunctions1 = new myFunctions;
    $is_ok1=($FmyFunctions1-&gt;is_ok());   
  ?&gt;
  </code></pre>
  
  <ol start="4">
  <li>The contents of app/library/myFunctions.php is : </li>
  </ol>
  
  <pre class="lang-html prettyprint-override"><code>&lt;?php namespace App\library {
  
      class myFunctions {
          public function is_ok() {
              return 'myFunction is OK';
          }
      }
  
  }
  ?&gt;
  </code></pre>
  
  <p>And it works.</p>
  
  <p><strong>But how to do so in Laravel 5 ???</strong></p>
  
  <p>PS : I read <a href="https://stackoverflow.com/questions/17088917/what-are-the-best-practices-and-best-places-for-laravel-4-helpers-or-basic-funct/17091089#17091089">What are the best practices and best places for laravel 4 helpers or basic functions?</a></p>
  
  <p>And tried to add <strong><em>"app/library/",</em></strong> to the <strong><em>autoload array</em></strong> and run <strong><em>composer dum-autoload</em></strong> , but it keeps give me error : </p>
  
  <blockquote>
    <p>FatalErrorException in xxxx line xx: Class 'myFunctions' not found</p>
  </blockquote>
  
  <p>I'm also already trying to use :</p>
  
  <pre><code>composer update
  composer dump-autoload 
  php artisan dump
  php artisan clear-compiled
  php artisan dump-autoload
  php artisan optimize
  php artisan route:clear
  php artisan route:scan
  php artisan route:list 
  </code></pre>
  
  <p>But still doesn't work...</p>