title: Use Illuminate database
body: <p>I want to use Illuminate database(<a href="https://github.com/illuminate/database" rel="nofollow">https://github.com/illuminate/database</a>). Not with Laravel, use only in my php file.
  I do</p>
  
  <pre><code>use Illuminate\Database\Capsule\Manager as Capsule;
  
  $capsule = new Capsule;
  
  $capsule-&gt;addConnection([
      'driver'    =&gt; 'mysql',
      'host'      =&gt; 'localhost',
      'database'  =&gt; 'database',
      'username'  =&gt; 'root',
      'password'  =&gt; 'password',
      'charset'   =&gt; 'utf8',
      'collation' =&gt; 'utf8_unicode_ci',
      'prefix'    =&gt; '',
  ]);
  </code></pre>
  
  <p>But it seems not working, and don't show any error message. Do I need to require any file? The illuminate directory is in the same directory with my php file.</p>
  
  <p>EDIT:</p>
  
  <p>I can use query now. Like this</p>
  
  <pre><code>$users = Capsule::table('users')-&gt;where('votes', '&gt;', 100)-&gt;get();
  </code></pre>
  
  <p>I don't know how to use model.</p>
  
  <p>User.php</p>
  
  <pre><code>class User extends Illuminate\Database\Eloquent\Model {
  }
  </code></pre>
  
  <p>My php file</p>
  
  <pre><code>require 'vendor/autoload.php';
  require 'User.php';
  $users = User::where('status', '=', 1)-&gt;get();
  </code></pre>
  
  <p>Got error</p>
  
  <pre><code>Fatal error: Call to a member function connection() on a non-object in /Users/someone/repos/test/vendor/illuminate/database/Illuminate/Database/Eloquent/Model.php on line 2472
  </code></pre>
  
  <p>SOLVED:</p>
  
  <p>Everything works fine. Use @majid8911 example <a href="https://github.com/mattstauffer/IlluminateNonLaravel" rel="nofollow">https://github.com/mattstauffer/IlluminateNonLaravel</a>
  Thank you everyone.</p>