zxxi7i/curd
最新稳定版本:v3.1.2
Composer 安装命令:
composer require zxxi7i/curd
包简介
CURD 页面构建器
README 文档
README
# 可视化CURD代码生成工具.
源码
gitee地址:https://gitee.com/zxxi7i/curd
文档
演示
安装
# 运行环境要求 PHP8+
composer require zxxi7i/curd
在线编辑生成页面
curd作为surface的自定义组件,完全遵循surface的开发规范,因此,你可以直接在surface中调用curd组件,无需任何配置,直接使用即可。
// 演示地址完整代码
<?php
use curd\Curd;
use surface\components\Input;
use surface\components\Number;
use surface\components\Upload;
use surface\components\TableColumn;
// 预定义的列
$tableColumns = [
(new TableColumn())->props(['label' => '用户名', 'prop' => 'username']),
(new TableColumn())->props(['label' => '年龄', 'prop' => 'age']),
(new TableColumn())->props(['label' => '手机号', 'prop' => 'phone']),
(new TableColumn())->props(['label' => '邮箱', 'prop' => 'email']),
(new TableColumn())->props(['label' => '头像', 'prop' => 'avatar']),
(new TableColumn())->props(['label' => '注册时间', 'prop' => 'create_time']),
];
$formColumns = [
(new Input(["label" => "用户名", "name" => "username"]))->rules(['required' => true, 'message' => '请输入用户名']),
(new Number(["label" => "年龄", "name" => "age"])),
(new Input(["label" => "手机号", "name" => "phone"])),
(new Input(["label" => "邮箱", "name" => "email"])),
(new Upload(["label" => "头像", "name" => "avatar"])),
];
// curd组件
$curd = (new Curd())->props([
'extComponent' => [
[
'label' => "扩展组件",
'components' => [
[
'component' => [
(new Input(['label' => 'Input1', 'name' => '第一项'])),
(new Input(['label' => 'Input2', 'name' => '第二项']))
],
'label' => '批量插入',
'icon' => "组件"
],
],
]
],
"default-form" => [
'options' => new \stdClass(),
'columns' => $formColumns,
],
"default-table" => [
'options' => [
"request" => [
"url" => ""
]
],
'columns' => $tableColumns,
]
]);
// 渲染页面
echo $curd->view();

根据数据库源生成默认配置
调用
Curd::withDbSource(\PDO $pdo, string $database, string $tableName = '')方法,指定数据库源,生成默认配置。
下面提供一个ThinkPHP在页面上选择数据库源的示例:
// 从参数中获取表名
$table = $this->request->get('table', '');
$curd = (new \curd\Curd())->props([
'extComponent' => [
[
'label' => "扩展组件",
'components' => [
[
'component' => [
(new Input(['label' => 'Input1', 'name' => 'Input1'])),
(new Input(['label' => 'Input2', 'name' => 'Input2']))
],
'label' => '批量插入',
'icon' => "组件"
],
],
]
],
])
// Tp框架获取Pdo连接:Db::connect()->connect()
->withDbSource(Db::connect()->connect(), '数据库名', $table);
$surface = new Surface();
// 下面代码提供一个下拉选择框浮动到页面上,选中表名之后生成默认配置
$surface->addStyle(
"<style>
.table-list{
position: fixed;
top: 10px;
right: 510px;
z-index: 99;
width: 200px;
}
</style>");
$tableNames = [];
foreach (Db::query("SHOW TABLES") as $info) {
$name = $info['Tables_in_surface'];
$tableNames[$name] = $name;
}
$surface->append((new Select())->props([
'class' => "table-list",
'filterable' => true,
'model-value' => new Vmodel("cur_table_name", $table),
'model-value' => $table,
// 将选中的表名同步到url刷新页面
'onChange' => Functions::create(<<<JS
let url = window.location.href
let paramName = 'table'
let pattern = new RegExp('(' + paramName + '=).*?(&|$)');
if (url.search(pattern)>=0) {
url = url.replace(pattern,'$1' + name + '$2');
} else {
url += (url.indexOf('?')>0 ? '&' : '?') + paramName + '=' + name;
}
window.location.href = url;
JS, ['name'])
])->options($tableNames));
$surface->append($curd);
return $surface->view();

zxxi7i/curd 适用场景与选型建议
zxxi7i/curd 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 05 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「curd」 「surface」 「Low Code」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 zxxi7i/curd 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 zxxi7i/curd 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 zxxi7i/curd 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
页面构建器
Ex-admin安装器
Ex-admin-laravel 是一个基于Ant Design of Vue + Laravel 开发而成后台系统构建工具,无需关注页面模板JavaScript,只用php代码即可快速构建出一个功能完善的后台系统。
Alfabank REST API integration
Ex-admin-hyperf 是一个基于Ant Design of Vue + hyperf 开发而成后台系统构建工具,无需关注页面模板JavaScript,只用php代码即可快速构建出一个功能完善的后台系统。
lumen curd auto maker
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-25