shish/microcrud
最新稳定版本:v2.4.0
Composer 安装命令:
composer require shish/microcrud
包简介
A minimal CRUD generating library
关键字:
README 文档
README
A library that you can point at a database table, and it'll give you a bunch of HTML forms for create / read / update / delete actions.
I kept re-implementing (badly) a bunch of code to do this stuff. Instead of implementing it badly a 10th time, I decided to put it into a self-contained library with the union of features.
Currently this uses FFS-PHP's PDO, but it wouldn't be too hard to use vanilla PDO if anybody requested that feature.
use \MicroCRUD\{Table, TextColumn, ActionColumn}; class MyTable extends Table { public function __construct($db) { parent::__construct($db); $this->set_columns([ TextColumn("username", "Username"), TextColumn("email", "Email Address"), ActionColumn() ]); } } $t = MyTable($db); print($t->table());
<table> <thead> [... titles and search fields ...] </thead> <tbody> [... contents of the table, in pages ...] </tbody> <tfoot> [... code to add a new entry ...] </tfoot> </table>
Notes for anything that might be non-obvious
The InetColumn type supports exact matching for most databases, but with Postgres, it supports range matching (eg searching for "1.2.3.0/24" will return search results including "1.2.3.6"). It'd be nice to support this cross-database, but pragmatically, one person has asked for this feature, they are using postgres as a backend, and postgres makes this trivial :P
Dev Notes
php -S localhost:4242 -t tests
统计信息
- 总下载量: 35.43k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-11-23