PHPackages                             rebelcode/expression-wp-query-builder-abstract - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rebelcode/expression-wp-query-builder-abstract

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rebelcode/expression-wp-query-builder-abstract
==============================================

Abstract functionality for building WP\_Query args using expressions.

v0.1-alpha1(8y ago)06GPL-3.0PHPPHP ^5.4 | ^7.0

Since Jan 4Pushed 8y ago3 watchersCompare

[ Source](https://github.com/RebelCode/expression-wp-query-builder-abstract)[ Packagist](https://packagist.org/packages/rebelcode/expression-wp-query-builder-abstract)[ RSS](/packages/rebelcode-expression-wp-query-builder-abstract/feed)WikiDiscussions develop Synced 3d ago

READMEChangelog (1)Dependencies (7)Versions (3)Used By (0)

RebelCode - Expression WP Query Builder - Abstract
==================================================

[](#rebelcode---expression-wp-query-builder---abstract)

[![Build Status](https://camo.githubusercontent.com/12360b9452caea48316b31a09be7929109971b337ed31cbdc6fb3f5e815342ad/68747470733a2f2f7472617669732d63692e6f72672f526562656c436f64652f65787072657373696f6e2d77702d71756572792d6275696c6465722d61627374726163742e7376673f6272616e63683d646576656c6f70)](https://travis-ci.org/RebelCode/expression-wp-query-builder-abstract)[![Code Climate](https://camo.githubusercontent.com/6d83798154bd3dc7e1192231d9f4ce4ecb89466d472b9d4d26de802a39381844/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f526562656c436f64652f65787072657373696f6e2d77702d71756572792d6275696c6465722d61627374726163742f6261646765732f6770612e737667)](https://codeclimate.com/github/RebelCode/expression-wp-query-builder-abstract)[![Test Coverage](https://camo.githubusercontent.com/433d549443d6a973baefa54233089900b359d958a96de0d2eb3f6ab6770e7b97/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f526562656c436f64652f65787072657373696f6e2d77702d71756572792d6275696c6465722d61627374726163742f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/RebelCode/expression-wp-query-builder-abstract/coverage)[![Latest Stable Version](https://camo.githubusercontent.com/954e3dbbb16c7ead565d86aa2577bb2109b66d85a9534dc756a67aa808dd80c6/68747470733a2f2f706f7365722e707567782e6f72672f726562656c636f64652f65787072657373696f6e2d77702d71756572792d6275696c6465722d61627374726163742f76657273696f6e)](https://packagist.org/packages/rebelcode/expression-wp-query-builder-abstract)

Abstract functionality for building `WP_Query` args using expressions.

Details
-------

[](#details)

This package provides abstract functionality for the most implementation aspects of building [`WP_Query`](https://codex.wordpress.org/Class_Reference/WP_Query) arguments from expressions. The traits in this package are meant to complement each other, while also remaining agnostic of the each other's implementation details. Most, if not all, traits are designed to provide functionality that depends on abstracted methods. Other traits in the package will offer implementations for those abstracted methods, while also depending on their own abstracted methods.

### Traits

[](#traits)

#### [`BuildWpQueryArgsCapableTrait`](src/BuildWpQueryArgsCapableTrait.php)

[](#buildwpqueryargscapabletrait)

**👁️ Build Args**

Intended to provide the entry point functionality of building an expression into [`WP_Query`](https://codex.wordpress.org/Class_Reference/WP_Query) args by attempting to build each expression term as either a comparison, meta query relation entry or taxonomy query relation entry.

- **Required implementations:**
    - `_buildWpQueryCompare()` - *fulfilled by [`BuildWpQueryCompareCapableTrait`](#buildwpquerycomparecapabletrait)*
    - `_buildWpQueryMetaRelation()` - *fulfilled indirectly by [`BuildWpQueryRelationTermCapableTrait`](#buildwpqueryrelationtermcapabletrait)*
    - `_buildWpQueryTaxTelation()` - *fulfilled indirectly by [`BuildWpQueryRelationTermCapableTrait`](#buildwpqueryrelationtermcapabletrait)*

---

#### [`BuildWpQueryCompareCapableTrait`](src/BuildWpQueryCompareCapableTrait.php)

[](#buildwpquerycomparecapabletrait)

**👁️ Build Comparison**

Provides functionality for building top-level comparison key-value pairs.

- **Required implementations:**
    - `_getWpQueryCompareKey()`
    - `_getWpQueryCompareValue()`
- **Complements:**
    - [`BuildWpQueryArgsCapableTrait`](#buildwpqueryargscapabletrait)

---

#### [`BuildWpQueryRelationCapableTrait`](src/BuildWpQueryRelationCapableTrait.php)

[](#buildwpqueryrelationcapabletrait)

**👁️ Build Relation**

Provides functionality for building relation arrays.

- **Required implementations:**
    - `_getWpQueryRelationOperator()` - *fullfilled by [`GetWpQueryRelationOperatorCapableTrait`](#getwpqueryrelationoperatorcapabletrait)*
    - `_buildWpQueryRelationTerm()` - *fulfilled by [`BuildWpQueryRelationTermCapableTrait`](#buildwpqueryrelationtermcapabletrait)*
- **Complements:**
    - [`BuildWpQueryRelationTermCapableTrait`](#buildwpqueryrelationtermcapabletrait)

---

#### [`BuildWpQueryRelationTermCapableTrait`](src/BuildWpQueryRelationTermCapableTrait.php)

[](#buildwpqueryrelationtermcapabletrait)

**👁️ Build Relation Term**

Provides functionality for building the terms in a relation array, by delegating building mechanism used depending on the current relation context, i.e. `meta_query` relation or `tax_query` relation.

- **Required implementations:**
    - `_buildWpQueryMetaCompare()` - *fulfilled by [`BuildWpQueryMetaCompareCapableTrait`](src/BuildWpQueryMetaCompareCapableTrait.php)*
    - `_buildWpQueryTaxCompare()` - *fulfilled by [`BuildWpQueryTaxCompareCapableTrait`](src/BuildWpQueryTaxCompareCapableTrait.php)*
- **Complements**
    - [`BuildWpQueryRelationTermCapableTrait`](#buildwpqueryrelationtermcapabletrait)

---

#### [`BuildWpQueryMetaCompareCapableTrait`](src/BuildWpQueryMetaCompareCapableTrait.php)

[](#buildwpquerymetacomparecapabletrait)

**👁️ Build Meta Comparison**

Provides functionality for building meta comparison arrays.

- **Required implementations:**
    - `_getWpQueryMetaCompareKey()`
    - `_getWpQueryMetaCompareValue()`
    - `_getWpQueryMetaCompareType()` - *fulfilled by [`GetWpQueryMetaCompareTypeCapableTrait`](src/GetWpQueryMetaCompareTypeCapableTrait.php)*
    - `_getWpQueryMetaCompareOperator()` - *fulfilled by [`GetWpQueryMetaCompareOperatorCapableTrait`](src/GetWpQueryMetaCompareOperatorCapableTrait.php)*
- **Complements:**
    - [`BuildWpQueryRelationTermCapableTrait`](#buildwpqueryrelationtermcapabletrait)

---

#### [`BuildWpQueryTaxCompareCapableTrait`](src/BuildWpQueryTaxCompareCapableTrait.php)

[](#buildwpquerytaxcomparecapabletrait)

**👁️ Build Taxonomy Comparison**

Provides functionality for building taxonomy comparison arrays.

- **Required implementations:**
    - `_getWpQueryTaxCompareTaxonomy()`
    - `_getWpQueryTaxCompareField()`
    - `_getWpQueryTaxCompareTerms()`
    - `_getWpQueryTaxCompareOperator()` - *fulfilled by [`GetWpQueryTaxCompareOperatorCapableTrait`](#getwpquerytaxcompareoperatorcapabletrait)*
- **Complements:**
    - [`BuildWpQueryRelationTermCapableTrait`](#buildwpqueryrelationtermcapabletrait)

---

#### [`GetWpQueryMetaCompareOperatorCapableTrait`](src/GetWpQueryMetaCompareOperatorCapableTrait.php)

[](#getwpquerymetacompareoperatorcapabletrait)

**👁️ Get Meta Comparison Operator**

Provides functionality for resolving the meta comparison compare type from an expression.

- **Complements:**
    - [`BuildWpQueryMetaCompareCapableTrait`](#buildwpquerymetacomparecapabletrait)

---

#### [`GetWpQueryMetaCompareTypeCapableTrait`](src/GetWpQueryMetaCompareTypeCapableTrait.php)

[](#getwpquerymetacomparetypecapabletrait)

**👁️ Get Meta Comparison Type**

Provides functionality for resolving the meta comparison value cast type from an expression.

- **Required implementations:**
    - `_getWpQueryMetaCompareValue()`
- **Complements:**
    - [`BuildWpQueryMetaCompareCapableTrait`](#buildwpquerymetacomparecapabletrait)

---

#### [`GetWpQueryTaxCompareOperatorCapableTrait`](src/GetWpQueryTaxCompareOperatorCapableTrait.php)

[](#getwpquerytaxcompareoperatorcapabletrait)

**👁️ Get Taxonomy Comparison Operator**

Provides functionality for resolving the taxonomy comparison operator from an expression.

- **Complements:**
    - [`BuildWpQueryTaxCompareCapableTrait`](#buildwpquerytaxcomparecapabletrait)

---

#### [`GetWpQueryRelationOperatorCapableTrait`](src/GetWpQueryRelationOperatorCapableTrait.php)

[](#getwpqueryrelationoperatorcapabletrait)

**👁️ Get Relation Operator**

Provides functionality for resolving the relation operator ("AND" or "OR") from an expression.

- **Complements:**
    - [`BuildWpQueryRelationCapableTrait`](#buildwpqueryrelationcapabletrait)

---

If all of the above traits are brought together, the implementing class is only required to implement the following:

- `_buildWpQueryMetaRelation()` - recommended to redirect to `buildWpQueryRelation` with a "meta" mode.
- `_buildWpQueryTaxRelation()` - recommended to redirect to `buildWpQueryRelation` with a "tax" mode.
- `_getWpQueryCompareKey()` - recommended to search the expression for a [`VariableTermInterface`](https://github.com/Dhii/expression-interface/blob/develop/src/VariableTermInterface.php) or an [`EntityFieldInterface`](https://github.com/Dhii/sql-interface/blob/develop/src/EntityFieldInterface.php) and retrieve the field.
- `_getWpQueryCompareValue()` - recommended to search the expression for a [`LiteralTermInterface`](https://github.com/Dhii/expression-interface/blob/develop/src/LiteralTermInterface.php).
- `_getWpQueryMetaCompareKey()` - recommended to search the expression for a [`VariableTermInterface`](https://github.com/Dhii/expression-interface/blob/develop/src/VariableTermInterface.php) or an [`EntityFieldInterface`](https://github.com/Dhii/sql-interface/blob/develop/src/EntityFieldInterface.php) and retrieve the field.
- `_getWpQueryMetaCompareValue()` - recommended to search the expression for a [`LiteralTermInterface`](https://github.com/Dhii/expression-interface/blob/develop/src/LiteralTermInterface.php).
- `_getWpQueryTaxCompareTaxonomy()` - recommended to search the expression for an [`EntityFieldInterface`](https://github.com/Dhii/sql-interface/blob/develop/src/EntityFieldInterface.php) and retrieve the entity.
- `_getWpQueryTaxCompareField()` - recommended to search the expression for an [`EntityFieldInterface`](https://github.com/Dhii/sql-interface/blob/develop/src/EntityFieldInterface.php) and retrieve the field.
- `_getWpQueryTaxCompareTerms()` - recommended to search the expression for a [`LiteralTermInterface`](https://github.com/Dhii/expression-interface/blob/develop/src/LiteralTermInterface.php).

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.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

Unknown

Total

1

Last Release

2921d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a5e9c220209499fbe84cad3f5c6aac842e76bd9bf498445e0a317b94f461903?d=identicon)[mecha](/maintainers/mecha)

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

---

Top Contributors

[![mecha](https://avatars.githubusercontent.com/u/5425482?v=4)](https://github.com/mecha "mecha (41 commits)")[![XedinUnknown](https://avatars.githubusercontent.com/u/1428973?v=4)](https://github.com/XedinUnknown "XedinUnknown (8 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rebelcode-expression-wp-query-builder-abstract/health.svg)

```
[![Health](https://phpackages.com/badges/rebelcode-expression-wp-query-builder-abstract/health.svg)](https://phpackages.com/packages/rebelcode-expression-wp-query-builder-abstract)
```

###  Alternatives

[overtrue/laravel-emoji

An emojione bridge for Laravel.

15040.8k3](/packages/overtrue-laravel-emoji)

PHPackages © 2026

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