PHPackages                             rkr/php-mysql-query-builder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. rkr/php-mysql-query-builder

ActiveLibrary[Database &amp; ORM](/categories/database)

rkr/php-mysql-query-builder
===========================

Easy to use query builder for PHP8.0+/PDO

0.5.3(3mo ago)245.6k1MITPHPPHP &gt;= 8.0

Since May 6Pushed 3mo ago7 watchersCompare

[ Source](https://github.com/rkrx/php-mysql-query-builder)[ Packagist](https://packagist.org/packages/rkr/php-mysql-query-builder)[ RSS](/packages/rkr-php-mysql-query-builder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (146)Used By (0)

mysql query builder (php 8.0+)
==============================

[](#mysql-query-builder-php-80)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/65058ca08f6cf380f1cfbee9972a03148bfc10abadb06a31713a75a7c80590f4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f726b72782f7068702d6d7973716c2d71756572792d6275696c6465722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/rkrx/php-mysql-query-builder/?branch=master)[![Build Status](https://camo.githubusercontent.com/5ac4c39d7e7f08caf88d8325d0d33ccaaa9fed342f19dd4ef51826ee80835404/68747470733a2f2f6170702e7472617669732d63692e636f6d2f726b72782f7068702d6d7973716c2d71756572792d6275696c6465722e7376673f6272616e63683d6d6173746572)](https://app.travis-ci.com/rkrx/php-mysql-query-builder)[![Latest Stable Version](https://camo.githubusercontent.com/a3880fbe29f4fc1a7a51f49ca92d3518c10956a8f9610d480c9123fc76456505/68747470733a2f2f706f7365722e707567782e6f72672f726b722f7068702d6d7973716c2d71756572792d6275696c6465722f762f737461626c65)](https://packagist.org/packages/rkr/php-mysql-query-builder)[![License](https://camo.githubusercontent.com/1c29ea9efd497fadfa500bc723939f5d3a985800984affbbf08828e60bc52524/68747470733a2f2f706f7365722e707567782e6f72672f726b722f7068702d6d7973716c2d71756572792d6275696c6465722f6c6963656e7365)](https://packagist.org/packages/rkr/php-mysql-query-builder)

Simple mysql query builder to build select, insert, update and delete queries with conditional parts. This library was initially not intended to build prepared statements, but this is also possible. The main motive for this library is an environment where a lot of things are automated.

Here a few things to keep in mind:

- The charset is up to you. No special binding to UTF8, although UTF8 is the default.
- You're allowed to nest most queries to build big and powerful queries.
- The order of method-calls of each statement-builder is irrelevant. The resulting query will always render the right order.

Some simplified examples
------------------------

[](#some-simplified-examples)

- [Initialization](doc/initialization.md)
- [Select](doc/select.md)
- [Insert](doc/insert.md)
- [Update](doc/update.md)
- [Delete](doc/delete.md)
- [Nested transactions](doc/nested-transactions.md)
- [Virtual/alias tables](doc/virtual-tables.md)
- [Temporary tables](doc/temporary-tables.md)

Some extended examples
----------------------

[](#some-extended-examples)

- [How a simple repository could look like](doc/simple-repository.md)

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance79

Regular maintenance activity

Popularity31

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 99.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Total

142

Last Release

112d ago

PHP version history (5 changes)0.0.3.5PHP &gt;= 5.4

0.1.53.1PHP &gt;= 5.6

0.2PHP &gt;= 7.0

0.2.2PHP &gt;= 7.1

0.4PHP &gt;= 8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7f83d7e57a4bf3f1309680dbfbbf2d022f0ee6dae64a4b3bdfbed1226f2f6bef?d=identicon)[rkr](/maintainers/rkr)

---

Top Contributors

[![rkrx](https://avatars.githubusercontent.com/u/5672982?v=4)](https://github.com/rkrx "rkrx (346 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rkr-php-mysql-query-builder/health.svg)

```
[![Health](https://phpackages.com/badges/rkr-php-mysql-query-builder/health.svg)](https://phpackages.com/packages/rkr-php-mysql-query-builder)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[cycle/database

DBAL, schema introspection, migration and pagination

64690.9k31](/packages/cycle-database)[guikingone/scheduler-bundle

A Symfony bundle that allows to schedule and create repetitive tasks

114217.4k](/packages/guikingone-scheduler-bundle)[symfony/ai-store

Low-level abstraction for storing and retrieving documents in a vector store.

19292.4k53](/packages/symfony-ai-store)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

845.7k](/packages/tommyknocker-pdo-database-class)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
