-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database and Middleware example #9
Comments
I'll show examples of using Slim middleware and DB connection with Laravel little bit later on docs. You have to add to your composer.json: composer require illuminate/database And use Eloquent somewhere on the app like this: ...
use Illuminate\Database\Capsule\Manager as ORM;
...
$orm = new ORM;
$orm->addConnection([
'driver' => getenv('DB_TYPE'),
'host' => getenv('DB_HOST'),
'port' => getenv('DB_PORT'),
'database' => getenv('DB_NAME'),
'username' => getenv('DB_USER'),
'password' => getenv('DB_PASSWORD'),
'options' => [ \PDO::ATTR_TIMEOUT => 5 ],
]);
$orm->setAsGlobal();
...
$rows = ORM::select("SELECT * FROM table");
... |
Thank you, i will wait for your examples. |
Eloquent performance is only at 50% of the equivalent PDO queries with prepared statements. Not good but no so bad either. I suppose Eloquent with entity models will be even slower. I'm struggling to find performant and popular ORM framework in PHP so stick with Eloquent now. |
Hi, I recommend the Idiorm, I have been using it for a few years, very simple and easy to use, but without the extra resources of Eloquent. |
Thanks for your framework. I try to use this, but i have a couple of questions.
The text was updated successfully, but these errors were encountered: