Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I would suggest using the <a href="https://github.com/illuminate/database#usage-outside-of-laravel-4" rel="nofollow">Illuminate/Database</a> package (part of Laravel 4). You won't get the <code>DB</code> interface, because that's a special facade provided by the Laravel Framework, but all the query builder functionality is available through the capsule.</p> <p>Install <code>illuminate/database</code> using <a href="http://getcomposer.org/" rel="nofollow">composer</a> and then follow the included <a href="https://github.com/illuminate/database#usage-outside-of-laravel-4" rel="nofollow">readme notes</a> (included below for completeness).</p> <hr> <h2>Illuminate Database</h2> <h3>Usage Outside Of Laravel 4</h3> <pre class="lang-php prettyprint-override"><code>$config = array( 'fetch' =&gt; PDO::FETCH_CLASS, 'default' =&gt; 'mysql', 'connections' =&gt; array( 'mysql' =&gt; array( 'driver' =&gt; 'mysql', 'host' =&gt; 'localhost', 'database' =&gt; 'laravel', 'username' =&gt; 'root', 'password' =&gt; 'password', 'charset' =&gt; 'utf8', 'collation' =&gt; 'utf8_unicode_ci', 'prefix' =&gt; '', ), ), ); $capsule = new Illuminate\Database\Capsule($config); // If you want to use the Eloquent ORM... $capsule-&gt;bootEloquent(); // Making A Query Builder Call... $capsule-&gt;connection()-&gt;table('users')-&gt;where('id', 1)-&gt;first(); // Making A Schema Builder Call... $capsule-&gt;connection()-&gt;schema()-&gt;create('users', function($t) { $t-&gt;increments('id'); $t-&gt;string('email'); $t-&gt;timestamps(); }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload