承接 itools/zendb 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

itools/zendb

Composer 安装命令:

composer require itools/zendb

包简介

Injection-proof PHP/MySQL database layer with automatic XSS-safe output

README 文档

README

ZenDB: PHP/MySQL Database Library

A PHP/MySQL database layer that's easy to use and hard to misuse.

  • SQL injection is impossible: ZenDB rejects any query with inline values. Every dynamic value goes through placeholders, not because you remembered, but because there's no other way.
  • XSS is prevented by default: Every value from the database HTML-encodes itself on output. You don't call htmlspecialchars(). Neither does the next developer.
  • Fast to learn, fast to use: The methods mirror SQL: select, insert, update, delete. If you know MySQL, you already know ZenDB, and if you don't, you will soon!

Why SQL?

Most database libraries invent their own query language - chained methods, builder patterns - that ends up just as complex as SQL but less powerful. ZenDB takes the opposite approach: don't teach people a complicated thing that replaces SQL. Just use SQL and make it safe.

SELECT, WHERE, JOIN, ORDER BY - that's all you need to query with ZenDB. The library handles the security (parameterization, escaping, validation) so you can write the SQL you already know without worrying about injection.

What's Inside

More documentation coming soon - querying, results, joins, placeholders, and more.

30-Second Quickstart

composer require itools/zendb
use Itools\ZenDB\DB;

// Connect
DB::connect([
    'hostname'    => 'localhost',
    'username'    => 'dbuser',
    'password'    => 'secret',
    'database'    => 'my_app',
    'tablePrefix' => 'app_',   // optional
]);

// Select rows
$users = DB::select('users', "status = ?", 'active');
foreach ($users as $user) {
    echo "Hello, $user->name!"; // auto HTML-encoded
}

// Get a single row
$user = DB::selectOne('users', "id = ?", 1);

// Insert a row
$newId = DB::insert('users', [
    'name'  => 'Alice',
    'city'  => 'Vancouver',
]);

// Update a row
$newValues = ['city' => 'Toronto'];
$where     = ['id' => $newId]; // arrays work too
DB::update('users', $newValues, $where);

// Delete a row
DB::delete('users', ['id' => $newId]);

// Full SQL when you need it (:: inserts your table prefix)
$rows = DB::query("SELECT name, city FROM ::users WHERE status = :status AND city = :city", [
    ':status' => 'active',
    ':city'   => 'Vancouver',
]);

When you might NOT want ZenDB

  • You need an ORM with models, migrations, or an ActiveRecord pattern
  • You need to support databases other than MySQL/MariaDB (and compatible alternatives)
  • You need async or non-blocking database queries
  • You prefer writing raw SQL without any abstraction

Related Libraries

  • SmartArray - Enhanced arrays with chainable methods
  • SmartString - Secure string handling with auto HTML-encoding

Questions?

Post a message in our forum.

License

MIT

itools/zendb 适用场景与选型建议

itools/zendb 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 277 次下载、GitHub Stars 达 3, 最近一次更新时间为 2026 年 04 月 01 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「database」 「dbal」 「sql」 「mysql」 「crud」 「secure」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 itools/zendb 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 itools/zendb 我们能提供哪些服务?
定制开发 / 二次开发

基于 itools/zendb 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 277
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 44
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-01