PHPackages                             ssnepenthe/wpdb-engine-for-latitude - 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. ssnepenthe/wpdb-engine-for-latitude

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

ssnepenthe/wpdb-engine-for-latitude
===================================

Build queries for wpdb using the latitude query builder

0.1.0(3y ago)03MITPHPPHP ^7.4 || ^8.0

Since Jul 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/ssnepenthe/wpdb-engine-for-latitude)[ Packagist](https://packagist.org/packages/ssnepenthe/wpdb-engine-for-latitude)[ RSS](/packages/ssnepenthe-wpdb-engine-for-latitude/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

wpdb-engine-for-latitude
========================

[](#wpdb-engine-for-latitude)

Use the [latitude](https://github.com/shadowhand/latitude) query builder to build queries for use in `wpdb`.

Warning
-------

[](#warning)

This package is currently in development and is subject to breaking changes without notice until v1.0 has been tagged.

It is one in a series of [WordPress toys](https://github.com/ssnepenthe?tab=repositories&q=topic%3Atoy+topic%3Awordpress&type=&language=&sort=) I have been working on with the intention of exploring ways to modernize the feel of working with WordPress.

As the label suggests, it should be treated as a toy.

Installation
------------

[](#installation)

```
composer require ssnepenthe/wpdb-engine-for-latitude
```

Usage
-----

[](#usage)

Start by reviewing the [latitude documentation](https://latitude.shadowhand.com/). Using this package will be largely the same.

The important differences are noted below:

### WpdbEngine

[](#wpdbengine)

The engine provided to the query factory should always be an instance of `WpdbEngine`:

```
use Latitude\QueryBuilder\QueryFactory;
use WpdbEngineForLatitude\WpdbEngine;

$factory = new QueryFactory(new WpdbEngine());
```

### Field Function

[](#field-function)

In place of the `Latitude\QueryBuilder\field()` function, use `WpdbEngineForLatitude\field()`:

```
use function WpdbEngineForLatitude\field;

$query = $factory
    ->select('id', 'username')
    ->from('users')
    ->where(field('id')->eq(5))
    ->compile();
```

### Search Function

[](#search-function)

In place of the `Latitude\QueryBuilder\search()` function, use `WpdbEngineForLatitude\search()`:

```
use function WpdbEngineForLatitude\search;

$query = $factory
    ->select()
    ->from('users')
    ->where(search('first_name')->begins('john'))
    ->compile();
```

With Wpdb
---------

[](#with-wpdb)

Once you have compiled a query instance you should pass the sql and params through the `wpdb->prepare()` method to get your final query string:

```
global $wpdb;

$queryString = $wpdb->prepare($query->sql(), ...$query->params());
```

And finally use it with any of the `wpdb` query methods:

```
$result = $wpdb->get_row($queryString);
```

More Examples
-------------

[](#more-examples)

Please refer to the tests in `tests/CodeReferenceExamplesTest.php` - The examples from the [`wpdb` code reference page](https://developer.wordpress.org/reference/classes/wpdb/) have been re-implemented there.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1406d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/acf42baca29dd8d1ffaf61009a3000068423a84db153c5cb864ef6fde64a1b87?d=identicon)[ssnepenthe](/maintainers/ssnepenthe)

---

Top Contributors

[![ssnepenthe](https://avatars.githubusercontent.com/u/10903810?v=4)](https://github.com/ssnepenthe "ssnepenthe (21 commits)")

---

Tags

toywordpress

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ssnepenthe-wpdb-engine-for-latitude/health.svg)

```
[![Health](https://phpackages.com/badges/ssnepenthe-wpdb-engine-for-latitude/health.svg)](https://phpackages.com/packages/ssnepenthe-wpdb-engine-for-latitude)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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