Skip to content
This repository was archived by the owner on Oct 25, 2026. It is now read-only.

Latest commit

 

History

History
69 lines (48 loc) · 2.52 KB

README.md

File metadata and controls

69 lines (48 loc) · 2.52 KB

Last updated: 2026-10-25

Note

This README was generated by SKILL, get the ZH version from here.


CHAIN YOUR QUERIES, NOT YOUR STRINGS!

Packagist License


A PHP MySQL client with chainable query building, read-write connection targets, and slow query logging

Table of Contents

Features

composer require pardnchiu/mysql-cli · Documentation

  • Chainable Query Building — Chain table, select, join, where, groupBy, orderBy, and limit to build SQL without hand-concatenated strings.
  • Read-Write Connection Targets — Read and write databases each get their own set of environment variables, chosen by an argument or the read / write methods.
  • Typed Parameter Binding — Every value goes through a prepared statement and binds as integer, boolean, null, or string to prevent SQL injection.
  • Connection Retry and Slow Query Logging — Failed connections retry three times with exponential backoff, and queries over 20 ms are written to error_log.
  • Pagination Total in One Query — A window function attaches the total row count to the same query, so pagination skips the second COUNT.

Architecture

Full Architecture

graph TB
    A[Caller] --> B[SQL::table / read / write]
    ENV[DB_READ_* / DB_WRITE_*] --> C[PDO connection + retry]
    B --> C
    B --> D[Query builder state]
    D --> E[SQL assembly]
    E --> F[query: prepare + bind]
    C --> F
    F --> G[(MySQL)]
    F --> H[Slow query error_log]
Loading

License

This project is licensed under the MIT LICENSE.

Author

Just open an issue to share an idea.

php-mysql-cli contributors

©️ 2024 邱敬幃 Pardn Chiu