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.4(3w ago)245.7k1MITPHPPHP &gt;= 8.0

Since May 6Pushed 3w 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 yesterday

READMEChangelog (10)Dependencies (11)Versions (147)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

57

—

FairBetter than 98% of packages

Maintenance94

Actively maintained with recent releases

Popularity30

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 ~31 days

Recently: every ~46 days

Total

143

Last Release

26d 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 (347 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

[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k373.5M3.3k](/packages/symfony-cache)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[kimai/kimai

Kimai - Time Tracking

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

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[cycle/database

DBAL, schema introspection, migration and pagination

71777.8k53](/packages/cycle-database)[api-platform/metadata

API Resource-oriented metadata attributes and factories

275.0M218](/packages/api-platform-metadata)

PHPackages © 2026

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