title: Laravel 4 class loading and facades
body: <p>I want to know how Laravel does class loading via Facades. </p>
  
  <p>I came across <a href="https://stackoverflow.com/a/14348858/1365918">this answer</a> that said that the <code>DB</code> alias/facade class loaded the code </p>
  
  <p>here <code>/vendor/laravel/framework/src/Illuminate/Database/Connection.php</code></p>
  
  <p>I tried following the advice given in the answer and following what the code does from index.php but could not understand how the <code>DB</code> Facade loaded the <code>Connection</code> class.</p>
  
  <p>I also got confused some more, because the answer had said that the <code>Connection</code> class is loaded, but that class has no <code>connection</code> method. Yet the documentation says and I have been able to use the connection method like, </p>
  
  <p><code>DB::connection('my-connection-name');</code> <a href="http://four.laravel.com/docs/database#accessing-connections" rel="nofollow noreferrer">here's the link to the docs for this</a></p>
  
  <p>I want to know where this is all mapped and how does the loading happen. I am guessing that composer has automated the mapping, but where is it actually happening when my application boots?</p>