1. Go to this page and download the library: Download overflowsith/slim-eloquent library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
overflowsith / slim-eloquent example snippets
= new Slim\App();
$dbSettings = [
'driver' => 'mysql',
'host' => '127.0.0.1',
'database' => 'database',
'username' => '',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
];
Overflowsith\SlimEloquent\Eloquent::boot($dbSettings);
class User extends Overflowsith\SlimEloquent\Model
{
}
$app->get('/', function ($request, $response, $args) use ($app) {
$userCount = User::count();
$response->write("# of users: " . $userCount);
return $response;
});
$app->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.