title: Class not found exception in a route of slim framework
body: <p>I'm starting with Slim+eloquent+twig  (using this presentation <a href="http://slides.com/revul/slimframework" rel="nofollow">http://slides.com/revul/slimframework</a> )  and getting this error:</p>
  
  <pre><code> Type: Error 
   Message: Class 'Localizacao' not found 
   File: /Users/Bigua/Sites/salas/src/routes.php 
   Line: 19 
  </code></pre>
  
  <p>I'm trying to list all from a table and pass it to my view. The command "composer update" don't returned any problem.</p>
  
  <p>here my code:</p>
  
  <p><strong>Composer.json:</strong></p>
  
  <pre><code>{
  "name": "slim/slim-skeleton",
  "description": "A Slim Framework skeleton application for rapid development",
  "keywords": ["microframework", "rest", "router", "psr7"],
  "homepage": "http://github.com/slimphp/Slim-Skeleton",
  "license": "MIT",
  "authors": [{
      "name": "Josh Lockhart",
      "email": "info@joshlockhart.com",
      "homepage": "http://www.joshlockhart.com/"
  }],
  "require": {
      "php": "&gt;=5.5.0",
      "slim/slim": "^3.1",
      "monolog/monolog": "^1.17",
      "illuminate/database": "~5.1",
      "slim/twig-view": "^2.1"
  },
  "autoload": {
      "psr-4": {
          "App/Models\\": "app/models"
      }
  }
  </code></pre>
  
  <p><strong>Route</strong></p>
  
  <pre><code>$app-&gt;get('/sala/add', function ($request, $response, $args) {
      $this-&gt;logger-&gt;info("Slim-Skeleton '/salas/add' route");
      // Render index view
      $args['locais'] = Localizacao::all();
      $this-&gt;logger-&gt;info("locais" . $args);
      return $this-&gt;renderer-&gt;render($response, 'add_sala.html.twig', $args);
  })-&gt;setName('sala_add');
  </code></pre>
  
  <p><strong>Model</strong></p>
  
  <pre><code>&lt;?php
    namespace App\Models;
  
    use Illuminate\Database\Eloquent\Model as Eloquent;
  
    class Localizacao extends Eloquent {
      protected $table = 'localizacao';
  
      protected $primaryKey = 'id_local';
      public $timestamps    = false;
    }
  </code></pre>
  
  <p>I had read many similar topics here and seems to me that is a problem with namespaces, but I just don't get it where its wrong. Sorry if this is a noob question.</p>
  
  <p>[SOLVED]</p>
  
  <p>The solution its following the two answers, from @marcin-nabiałek and @geggleto  :</p>
  
  <p>Fixed the psr-4:   </p>
  
  <pre><code>"psr-4": {
      "App\\Models\\": "app/models"
  }
  </code></pre>
  
  <p>And using namespace correctly:</p>
  
  <pre><code>  \App\Models\Localizacao::all()
  </code></pre>
  
  <p>Tnx a lot !!!</p>