basteyy/medoo-orm
Composer 安装命令:
composer require basteyy/medoo-orm
包简介
An ORM Mapper for using Medoo as an Object-ORM Tool
README 文档
README
Hi! This is (my personal) Medoo ORM Mapping-Class for mapping the database based on Medoo into classes.
Setup
Use composer to add the Mapper to your code:
composer require basteyy/medoo-orm
Config
There are a few ways to config this.
Create the Medoo-Instance by yourself
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);
Use Dependency Injection
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); } ]);
Passing the config as a array
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);
License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
统计信息
- 总下载量: 28
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: CC-BY-NC-SA-4.0
- 更新时间: 2021-10-10