Download the PHP package efoft/query-builder without Composer

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

QueryBuilder: SQL

=== The package allows to produce native SQL queries making multiple and chanable calls on class object. SQL queries are injection-protected with substitutors. Also there is the method to get all binded values for such substitutors.

Installation


The package is intended to be used via Composer. Add this to you composer.json:

or just run via command-line:

Initialization


There are 2 optional argument for class construct:

Usage


You can call methods on created $q object one by one in a chain way to fill all required parameters to generate a query. Important! If you reuse $q for new query, first call ->newQuery() method.

It's possible to run the following methods multiple times, the parameters will be aggregated. It's useful if some query changes are conditional.

Methods table() and from() are just aliases. Specifiing multiple table is worth only for SELECT queries. For all the rest only first table will be used. All above methods except from where() can accept arguments in several possible ways:

Method where() specifies WHERE conditions via array. The format is similar to MongoDB find() syntax, but so far limited with $or and $and operators.

Examples below illustrate it in more details.

Select

Method ->select(). Can chain and can be called multiple times. Duplicates are automatically removed. For specifying aliases use associative arrays: array('field'=>'alias', ...). The following methods allow to set ORDER BY, GROUP BY, LIMIT and DISTINCT directives:

Insert

Method ->insert(). Can chain and can be called multiple times. Arguments must be associative arrays like array('field'=>'value'...).

Update

Method ->update(). Can chain and can be called multiple times. Arguments must be associative arrays like array('field'=>'value'...).

Delete

Method ->delete(). Does not require any arguments, but the conditions must follow with where().

Join

Method ->join(). It has 3 mandatory arguments (joined table, key field in main table, key fields in joined table) and 1 optional - type of join (by default LEFT is used). For key fields there is no need to specify them as fully-qualified, it's done automatically. Join is applicable to select, update and delete statements and can be run multiple time if many tables are joined.

Retrieve results

To get resulted query:

To get binded values:


All versions of query-builder with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
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 efoft/query-builder contains the following files

Loading the files please wait ....