Download the PHP package pressgang-wp/quartermaster without Composer

On this page you can find all versions of the php package pressgang-wp/quartermaster. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package quartermaster

cl

βš“ Quartermaster

Quartermaster is a fluent, args-first builder for WP_Query.

It helps you build complex query arrays in readable, composable steps, while staying 100% WordPress-native under the hood. It ships as a standalone package in the pressgang-wp ecosystem, but it does not depend on the PressGang theme framework.

Think of it as a reliable quartermaster for your query cargo: you decide what goes aboard, nothing gets smuggled in. 🧭


πŸ“¦ Install

Requirements: PHP 8.3+.


πŸ—ΊοΈ Quick Reference Method Index

Area Methods
Bootstrap posts(), terms(), prepare() (compatibility alias)
Core post constraints postType(), status(), whereId(), whereInIds(), excludeIds(), whereParent(), whereParentIn()
Author constraints whereAuthor(), whereAuthorIn(), whereAuthorNotIn()
Pagination / search paged(), limit(), all() (fetch all: posts_per_page=-1, nopaging=true), search()
Query-var binding bindQueryVars(), Bind::paged(), Bind::tax(), Bind::orderBy(), Bind::metaNum(), Bind::search()
Ordering orderBy(), orderByAsc(), orderByDesc(), orderByMeta(), orderByMetaAsc(), orderByMetaDesc(), orderByMetaNumeric(), orderByMetaNumericAsc(), orderByMetaNumericDesc()
Meta query whereMeta(), orWhereMeta(), whereMetaNot(), whereMetaLikeAny(), whereMetaDate(), whereMetaExists(), whereMetaNotExists()
Tax query whereTax()
Date query whereDate(), whereDateAfter(), whereDateBefore()
Query-shaping flags idsOnly(), noFoundRows(), withMetaCache(), withTermCache()
Conditional & hooks when(), unless(), tap()
Macros macro(), hasMacro(), flushMacros()
Escape hatch tapArgs()
Introspection toArgs(), explain()
Terminals get(), toArray(), wpQuery(), timber(), applyTo()
Terms core taxonomy(), objectIds(), hideEmpty(), slug(), name(), fields(), include(), exclude(), excludeTree(), parent(), childOf(), childless(), search()
Terms pagination / ordering limit(), offset(), page(), orderBy()
Terms meta query whereMeta(), orWhereMeta()
Terms terminal get(), timber()

πŸ€” Why Fluent?

WP_Query arrays are powerful, but as they grow they become harder to scan, review, and refactor.

Quartermaster gives you:

You still end up with plain WordPress args.
No ORM. No hidden query engine. No lock-in. Just well-organised cargo. βš“

Sometimes raw WP_Query is fine β€” if your query is short and static, use it.
Quartermaster shines when queries evolve, branch, or need to be composed without losing your bearings. 🧭


🧠 Design Philosophy

Quartermaster is intentionally light-touch:

Steady hands on the wheel, predictable seas ahead. 🚒


🚫 Non-Goals (Read Before Boarding)

Quartermaster deliberately does not aim to:

If WordPress requires a specific argument shape, Quartermaster expects you to be explicit.
No fog, no illusions, no siren songs. πŸ§œβ€β™€οΈ


πŸš€ Quick Start

posts('event') is a convenience seed only. It only sets post_type and does not infer any other query args.

prepare() remains available as a low-level backwards-compatible alias.

Run the query and get posts:

When you need the full WP_Query object (pagination metadata, found rows, loop state):

🌿 Terms Quick Start

Filter by slug, get just IDs, or scope to a specific post:

Inspect generated args:

πŸ”— Binding Query Vars (Two Styles)

Nothing reads query vars unless you explicitly call bindQueryVars().

Map style with Bind::*:

Fluent binder style with Binder:

If no taxonomy is provided, Binder assumes the taxonomy name matches the query var key.

Both styles are explicit and compile to the same binding map. No smuggling, no hidden defaults.


πŸ—“οΈ Common Pattern: Meta Date vs Today

Filtering by a meta date (e.g. upcoming vs past events) is a very common WordPress pattern.

This keeps intent explicit:

No hidden assumptions. No barnacles. βš“


πŸ”Œ Macros (Project-Level Sugar)

Macros let you register project-specific fluent methods without bloating the core API. They are opt-in, not part of core β€” use them for patterns that repeat across your project.

Macros should call existing Quartermaster methods β€” avoid mutating internal args directly. Macro invocations are recorded in explain() as macro:<name> for debuggability.

Register macros in your theme's functions.php or a service provider. Both builders (Quartermaster and TermsBuilder) support macros independently.


πŸ”€ Conditional Queries & Hooks

when(), unless(), and tap() keep fluent chains readable without introducing magic or hidden state. None of them read globals or add defaults.

when() β€” runs a closure when the condition is true:

Or with an else clause:

unless() β€” inverse of when() (unless($x) is when(!$x)):

tap() β€” always runs a closure, for builder-level logic without breaking the chain:

All three are recorded in explain() for debuggability. No magic, no hidden state. βš“


πŸͺ Query Hooks (pre_get_posts)

applyTo() modifies an existing WP_Query in place instead of creating a new one β€” designed for WordPress pre_get_posts hooks:

When multiple hooks call applyTo(), clause arrays (tax_query, meta_query, date_query) are merged with existing clauses β€” not overwritten β€” so hooks compose safely.

applyTo() is a void terminal: it does not return the builder. If you need to inspect the applied args, hold a reference to the builder and call explain() separately.


🌲 Optional Timber Terminal

If Timber is unavailable, Quartermaster throws a clear runtime exception rather than hard-coupling Timber into core.


πŸ” Debugging & Introspection

Ordering direction is explicit: Quartermaster accepts only ASC/DESC; invalid values are normalized to method defaults and surfaced in explain() warnings.

Inspect generated args:

Inspect args plus applied calls and warnings:

Perfect for reviews, debugging, and keeping junior crew out of trouble. 🧭

Smooth seas and predictable queries.
Happy sailing. βš“πŸš’


All versions of quartermaster with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pressgang-wp/quartermaster contains the following files

Loading the files please wait ...