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.6(1mo ago)245.9k1MITPHPPHP &gt;= 8.0

Since May 6Pushed 1mo 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 2w ago

READMEChangelog (10)Dependencies (17)Versions (149)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.

Optional Rust module
--------------------

[](#optional-rust-module)

An optional Rust-backed PHP extension is available at [rkrx/php-rust-mysql-query-builder-module](https://github.com/rkrx/php-rust-mysql-query-builder-module). It provides a native query-builder module that can take over SQL-builder state and rendering while the PHP adapter keeps PDO execution, transactions, logging and fetch helpers compatible with this package.

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

57

—

FairBetter than 98% of packages

Maintenance90

Actively maintained with recent releases

Popularity32

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

Recently: every ~43 days

Total

145

Last Release

45d 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 (350 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

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[kimai/kimai

Kimai - Time Tracking

4.8k9.4k1](/packages/kimai-kimai)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[symfony/ai-store

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

22443.1k142](/packages/symfony-ai-store)[perplorm/perpl

Perpl is an improved and still maintained fork of Propel2, an open-source Object-Relational Mapping (ORM) for PHP.

2414.4k](/packages/perplorm-perpl)

PHPackages © 2026

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