Hi! This is (my personal) Medoo ORM Mapping-Class for mapping the database based on Medoo into classes.
Use composer to add the Mapper to your code:
composer require basteyy/medoo-orm
There are a few ways to config this.
You can create the medoo instance somewhere in your code and than load the tables by passing it:
$config = []; // Config
$medoo = new \Medoo\Medoo($config);
$usersTable = new UsersTable($medoo);
Create a definition somewhere in your code and simple call the tables:
$DI->addDefinitions([
\Medoo\Medoo::class => function () {
$config = []; // Config
return new \Medoo\Medoo($config);
},
// OR (!!)
'connection' => => function () {
$config = []; // Config
return new \Medoo\Medoo($config);
},
// OR (!!)
'DB' => => function () {
$config = []; // Config
return new \Medoo\Medoo($config);
},
// OR (!!)
'DatabaseConnection' => => function () {
$config = []; // Config
return new \Medoo\Medoo($config);
}
]);
You can simple pass the config as an array to the tables and let the script doing the instance-job:
$config = []; // The Config
$usersTable = new FancyTableClassTable($config);
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.