Download the PHP package stephenharris/wp-query-builder without Composer

On this page you can find all versions of the php package stephenharris/wp-query-builder. 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 wp-query-builder

WP Query builder

An expressive query builder for WordPress based on Laravel's Query Builder. Wraps the $wpdb global.

Build Status

How to use in managed environments

If you wish to use this extension in a managed environment, simply install using composer:

To use the Query builder

How to use in distributed plug-ins

Since there is no way to manage dependencies between plug-ins, bundling this library inside a plug-in will likely cause errors (possibly fatal errors) if used with another plug-in that also includes it.

The safe way to bundle this library inside your plug-in is to use Mozart. This copies it the codebase, but wraps it inside a custom namespace.

You'll need to handle autoloading of the library classes. They can be autoloaded according to PSR-4 from your Mozart destination directory.

Data Sanitisation

The purpose of this library is to provide an expressive and **safe*** way to run queries against your WordPress database (typically involving custom tables).

To this end all values provided are escaped, but note that column and table names are not yet escaped. In any case, even if they were you should be whitelisting any allowed columns/tables: otherwise using user-input, or other untrusted data to determine the column/table could allow an attacker to retrieve data they shouldn't or generate a map of your database.

Querying Results

Retrieving all rows from a table

Retrieve a single row

Retrieve a single column

To retrieve the first column in the returned results:

To retrieve a particular column

To retrieve a value

Basic Where clauses

Adds a WHERE clause, matching records where the column value equals/not equals/ greater than/ less than / greater than or equals / less than equals (=/, !=, >, <, >=, <=);

To add an OR condition, use orWhere($column, $operator, $value).

Where column value IN

Adds a WHERE clause, matching records which have a column value in the array provided:

Where column value IN

Adds a WHERE clause, matching records which have a column value in the array provided:

Where column value BETWEEN

Adds a WHERE clause, matching records which have a column value between two specified values:

Search for a field

Performs a LIKE comparison on one ore more fields fields.

To search in multiple columns you can pass an array of columns:

Complex Where clauses

The andWhere (and its alias where), and orWhere all also accept a WhereCause instances. This allows you to build more complex queries, such as nested WHERE conditions.

Joining

There are four methods for joining:

Methods

Insert records

The Query::insert method will insert a record with the given column / values (given an array, where the column is the key). You must call Query::table with the name of the table specified.

Delete records

The Query::delete method will execute a delete command for the table specified, via the Query::table or Query::from command. The delete method must be called after any where conditions, as otherwise you will delete the entire table.

Error handling

Calling a method incorrectly (e.g. calling Query::get without first calling Query::table, or passing a field to getColumn that was not included in the query Results) will results in a LogicException (either BadMethodCallException or InvalidArgumentException).

If the SQL query fails then a WPQueryBuilder\QueryException is thrown.


All versions of wp-query-builder with dependencies

PHP Build Version
Package Version
No informations.
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 stephenharris/wp-query-builder contains the following files

Loading the files please wait ....