Skip to content

Querycase

Fast, methods-chaining, dependency-free library to create SQL Queries in WordPress.

Lightweight

No extra connections

Schema Declaration

Query Builders

Schema Introspection

Pagination

Querycase provides a convenient, fluent interface for creating and running database queries in WordPress. Without establishing an additional connection to the database.

It acts as a layer sitting on top of the internal WordPress $wpdb class and all queries are run through it.

⚠️

This framework is currently in beta. Breaking changes may occur until version 1.0.0 is tagged.

Acknowledgements

Querycase database is a modified fork of Spiral Database originally developed by Anton Titov and maintained by Spiral Scout. Without them, Querycase wouldn't exist.

Why the fork?

Querycase has been created with the purpose of being used in public WordPress plugins where developers don't always have full control of the environment.

By design, Spiral Database uses PDO and creates an additional connection to the WordPress database. While using PDO may be the best option (when compared to $wpdb), this creates some issues:

Querycase drops the usage of PDO and runs all queries through $wpdb while still giving you access to the majority of features that Spiral Database offers.

Requirements

  • PHP 7.2+
  • PDO Extension.
  • Composer.

While the PDO Extension is required, no connection and no queries are made through it.