PHPackages                             codesvault/howdy-qb - 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. codesvault/howdy-qb

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

codesvault/howdy-qb
===================

Mysql Query Builder for WordPress

2.2.2(2mo ago)371.2k8[2 issues](https://github.com/CodesVault/howdy_qb/issues)1MITPHPPHP &gt;=7.4

Since Dec 13Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/CodesVault/howdy_qb)[ Packagist](https://packagist.org/packages/codesvault/howdy-qb)[ Fund](https://wise.com/pay/me/keramot-ul-i?utm_source=quick_pay)[ RSS](/packages/codesvault-howdy-qb/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (31)Used By (1)

WP Query Builder
================

[](#wp-query-builder)

Relational Database Query builder for WordPress. WP Query Builder uses `PDO` for database queries. It has **zero dependencies** with third-party query builders or any other composer library.

[![Total Downloads](https://camo.githubusercontent.com/fa7ab13d76a58ac0f786b69a0405e9f05fb3b1cbfe8ee51523b64db91a65fb8b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f6465737661756c742f686f7764792d71622e737667)](https://packagist.org/packages/codesvault/howdy-qb)[![Latest Version](https://camo.githubusercontent.com/4b99a27a603388e4ab9564df4650ab20a8b032dabf2ea7d8a4fcd984b3c52281/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f6465737661756c742f686f7764792d71622e737667)](https://packagist.org/packages/codesvault/howdy-qb)

[![PHP Version](https://camo.githubusercontent.com/d2b2bbd9ca029398fe42046acbced5e8e387dd3fe0414de67b189a9cb14d21d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f636f6465737661756c742f686f7764792d71622e737667)](https://packagist.org/packages/codesvault/howdy-qb)[![Composer](https://camo.githubusercontent.com/569b817a1245570fba97954242751967d1fcb509a7c1094b71c75b2649fbcfa8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6d706f7365722d322e302532422d626c75652e737667)](https://getcomposer.org/)[![License](https://camo.githubusercontent.com/5946215b2aaa6c2cc98bb5f8e731954fb1c7b43f2413a08164244ab1eed9da28/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f636f6465737661756c742f686f7764792d71622e737667)](LICENSE)

Documentation
=============

[](#documentation)

Documentation website [here](https://wpqb.abmsourav.com/).

Roadmap
-------

[](#roadmap)

We have an active roadmap with planned features and improvements. Check out the full discussion and share your feedback:

[View Roadmap Discussion](https://github.com/CodesVault/howdy_qb/discussions/48)

### Installation:

[](#installation)

```
composer require codesvault/howdy-qb

```

Examples
--------

[](#examples)

### Create Table

[](#create-table)

```
DB::create('querybuilder')
	->column('ID')->bigInt()->unsigned()->autoIncrement()->primary()->required()
	->column('user_id')->bigInt()->unsigned()->required()
	->column('name')->string(255)->required()
	->column('email')->string(255)->nullable()
	->column('settings')->enum(['active', 'inactive'])
	->column('created_at')->timestamp('now', 'current')
	->foreignKey('user_id', 'users.ID', 'cascade')
	->index(['ID'])
	->execute();
```

### Insert Statement

[](#insert-statement)

```
DB::insert('querybuilder', [
    [
        'name' => 'Keramot UL Islam',
        'email' => 'keramotul.@gmail.com',
    ]
])
->execute();
```

### Update Statement

[](#update-statement)

```
DB::update('querybuilders', [
    'name' => 'Keramot UL',
    'email' => 'keramotul.islam@gmail.com'
])
->where('ID', '=', 10)
->andWhere('name', '=', 'Abm Sourav')
->execute();
```

### Select Statement

[](#select-statement)

```
$result =
DB::select('qb.ID', 'qb.name, qb.email')
    ->from('querybuilders')
    ->alias('qb')
    ->groupBy('name')
    ->get();

// *** where clouse
$result =
DB::select('posts.ID', 'posts.post_title')
    ->distinct()
    ->from('posts posts')
    ->where('posts.post_status', '=', 'publish')
    ->orderBy('post_title', 'DESC')
	// ->orderBy(['post_title' => 'ASC', 'ID' => 'DESC'])
    ->limit(10)->offset(2)
    ->get();

// *** JOIN
DB::select('users.display_name name')
    ->count('posts.ID', 'posts')
    ->from('users users')
    ->join('posts posts')
    ->where('posts.post_status', '=', 'publish')
    ->andWhere('posts.post_type', '=', 'post')
    ->get();

// raw sql
DB::select('posts.post_title')
    ->from('posts posts')
    ->raw("WHERE posts.post_type = 'post'")
    ->andWhere('posts.post_status', '=', 'publish')
    ->raw("LIMIT 10")
    ->get();

DB::select()
    ->columns('country')
    ->avg('age', 'avg_age')
    ->min('age', 'youngest')
    ->max('age', 'oldest')
    ->from('users')
    ->groupBy('country')
    ->get();
```

#### Sub Query

[](#sub-query)

```
DB::select('*')
	->from('querybuilder')
	->whereIn('age', function ($subQuery) {
		$subQuery->select('age')
		->from('users')
		->where('country', '=', 'Bangladesh');
	})
	->andWhere('name', '', 'Keramot')
	->get();
```

### Delete Statement

[](#delete-statement)

```
// delete one row
DB::delete('posts')
    ->where('ID', '=', 3)
    ->execute();

// delete all records
DB::delete('posts')->execute();

// Recommended for deleting all records from a table
DB::truncate('test_table');
```

### Drop Statement

[](#drop-statement)

```
DB::drop('posts');
DB::dropIfExists('terms');
```

### Alter Statement

[](#alter-statement)

```
DB::alter('cv_users')
    ->modify('name', 'username')->string(455)->required()
    ->modify('settings')->json()
    ->execute();
```

### Single instence

[](#single-instence)

Expressions also can be exicuted with one instence of `DB` class. By doing this database connection will be stablished only once.

```
$db = new DB();

$result =
$db::select('posts.ID', 'posts.post_title')
    ...

$db::create('meta')
    ...
```

### Database Connection

[](#database-connection)

By default database connection will set out of the box, automaically. But you can also manually input database configurations. This way, you also can debug your database queries from terminal.

```
$db = DB::setConnection(
	[
		"dbhost"        => 'mysql_host',
		"dbname"        => 'database_name',
		"dbuser"        => 'database_user',
		"dbpassword"    => 'database_password',
		"prefix"        => 'database_table_prefix'
	]
);
```

### Driver

[](#driver)

The default driver is `pdo`. But if you want to use `wpdb` which uses Mysqli, you also can do that by changing the driver.

```
$db = new DB('wpdb');

$db::select('posts.post_title')
    ->from('posts posts')
    ->get();
```

Dev Envirenment Setup for Contributors
--------------------------------------

[](#dev-envirenment-setup-for-contributors)

Want to contribute to this package? Please follow the steps below.

- Create a local WordPress envirenment setup.
- Create a basic plugin.
- Run `composer init` into the plugin.
- Clone `git@github.com:CodesVault/howdy_qb.git` into plugin folder.
- Add repository for local package in plugin's `composer.json`. ```
    "repositories": [
    	{
    		"type": "path",
    		"url": "./howdy_qb",
    		"options": {
    			"symlink": true
    		}
    	}
    ],

    ```
- Require this package. `composer require "codesvault/howdy-qb @dev"`

###  Health Score

50

—

FairBetter than 96% of packages

Maintenance87

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.3% 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 ~42 days

Recently: every ~9 days

Total

29

Last Release

61d ago

Major Versions

1.7.1 → 2.0.02025-12-03

PHP version history (2 changes)1.0.0PHP &gt;=7.4

1.1.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/8078871c211cddf84f3fcff8321f973ed3324aa0c54d0d8a2b5c3ad9ffa2fca2?d=identicon)[abmSourav](/maintainers/abmSourav)

---

Top Contributors

[![AbmSourav](https://avatars.githubusercontent.com/u/39233955?v=4)](https://github.com/AbmSourav "AbmSourav (183 commits)")[![alaminfirdows](https://avatars.githubusercontent.com/u/30468274?v=4)](https://github.com/alaminfirdows "alaminfirdows (6 commits)")[![arif98741](https://avatars.githubusercontent.com/u/17213478?v=4)](https://github.com/arif98741 "arif98741 (2 commits)")[![sayedulsayem](https://avatars.githubusercontent.com/u/26276444?v=4)](https://github.com/sayedulsayem "sayedulsayem (1 commits)")

---

Tags

composercomposer-librarycomposer-packagedatabasemysqlpdo-mysqlpdo-phpphpqueryquery-builderquerybuilderrelational-databaseswordpresswordpress-developmentwordpress-php-librarywordpressdatabasemysqlpdoquerybuilderwpmysqliquery builder

###  Code Quality

TestsPest

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/codesvault-howdy-qb/health.svg)

```
[![Health](https://phpackages.com/badges/codesvault-howdy-qb/health.svg)](https://phpackages.com/packages/codesvault-howdy-qb)
```

###  Alternatives

[envms/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

925511.7k13](/packages/envms-fluentpdo)[lichtner/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

921274.8k6](/packages/lichtner-fluentpdo)[fpdo/fluentpdo

FluentPDO is a quick and light PHP library for rapid query building. It features a smart join builder, which automatically creates table joins.

921244.9k7](/packages/fpdo-fluentpdo)[opis/database

A database abstraction layer over PDO, that provides a powerful and intuitive query builder, bundled with an easy to use schema builder

10184.2k3](/packages/opis-database)[bentools/where

PHP7.1 Fluent, immutable SQL query builder. Connectionless, framework-agnostic, no dependency.

125.2k2](/packages/bentools-where)

PHPackages © 2026

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