-
-
Save notomato/11217568 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"require": { | |
"slim/slim": "2.*", | |
"illuminate/database": "*", | |
"dhorrigan/capsule": "*" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'vendor/autoload.php'; | |
$app = new \Slim\Slim(); | |
use Illuminate\Database\Capsule\Manager as Capsule; | |
$capsule = new Capsule; | |
$capsule->addConnection(array( | |
'driver' => 'mysql', | |
'host' => 'localhost', | |
'database' => 'database', | |
'username' => 'root', | |
'password' => '', | |
'prefix' => '', | |
'charset' => 'utf8', | |
'collation' => 'utf8_general_ci', | |
)); | |
$capsule->bootEloquent(); | |
$capsule->setAsGlobal(); | |
// Connect using the Laravel Database component | |
$conn = $capsule->connection(); | |
use Illuminate\Database\Eloquent\Model as Model; | |
// Define models | |
class users extends Model {} | |
$app->get('/', function () use ($app) { | |
print_r( my_table::all() ); | |
}); | |
$app->run(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment