Skip to content

Instantly share code, notes, and snippets.

@diegocasmo
Created October 28, 2014 17:35
Show Gist options
  • Save diegocasmo/ff72587dda7ca0a03ead to your computer and use it in GitHub Desktop.
Save diegocasmo/ff72587dda7ca0a03ead to your computer and use it in GitHub Desktop.
Laravel Eloquent setup snippet for use outside of the framework.
<?php
/* Setup Eloquent. */
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
$capsule = new Capsule;
$capsule->addConnection([
"driver" => "mysql",
"host" => "127.0.0.1",
"database" => "",
"username" => "",
"password" => "",
"charset" => "utf8",
"collation" => "utf8_general_ci",
"prefix" => ""
]);
$capsule->setEventDispatcher(new Dispatcher(new Container));
$capsule->bootEloquent();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment