mrmadclown/mnemosyne
最新稳定版本:v1.3
Composer 安装命令:
composer require mrmadclown/mnemosyne
包简介
Mnemosyne a PDO Database Layer
README 文档
README
This is a simple PDO based mysql Query Builder
Installation
composer require mrmadclown/mnemosyne
Usage
The Builder gets constructed by passing an instance of the PDO::class to
the \MrMadClown\Mnemosyne\Builder::class
use \PDO; $pdo = new \PDO(); $builder = new \MrMadClown\Mnemosyne\Builder($pdo);
With the Builder Object a mysql query can be build similar to how a query would be written:
... $builder->select('*')->from('users')->where('id', 1);
Important
By default, the PDO Fetch Mode is set to PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE; which means you have to have a
class which represents your table
#User.php class User { public int $id; public string $name; } $builder->setClassName(User::class)->fetchAll(); // returns an array of Users
you can use the magic __set method to map your database columns into your model.
If you don`t want a different FetchMode you can call $builder->setFetchMode(\PDO::FETCH_ASSOC)
to change the fetch mode of the Builder instance.
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-27