Download the PHP package model/query-builder without Composer

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

A powerful SQL query builder for PHP that provides a fluent interface for constructing database queries with automatic validation against your database schema.

Features

Basic Usage

INSERT Queries

Simple Insert

Bulk Insert

Insert Options

Empty Insert

UPDATE Queries

Simple Update

Update with WHERE Clause

Update with Joins

Update Options

DELETE Queries

Simple Delete

Delete with WHERE Clause

Delete with Joins

SELECT Queries

Simple Select

Select Specific Fields

Select with Aliases

Select with Raw Fields

Aggregation Functions

GROUP BY and HAVING

ORDER BY

LIMIT and OFFSET

Joins

Simple Join (Auto-detected FK)

Join with Specific Fields

Join with Custom ON Clause

Join with Alias

Join with WHERE Condition

Join Types

Select Options

WHERE Clauses

Simple Conditions

Comparison Operators

NULL Comparisons

BETWEEN

IN and NOT IN

LIKE

MATCH (Full-text Search)

AND Operator (Default)

OR Operator

Nested Conditions

Complex Nested Example

Sub-operator Format

Array Format for Conditions

Raw SQL Conditions

Table Prefixes in WHERE

UNION SELECT

Combine multiple SELECT queries:

Special Data Types

POINT (Geospatial)

The QueryBuilder automatically handles POINT columns:

JSON

DateTime Objects

Utility Methods

Build Query String

Build a WHERE clause string separately:

Parse Column

Format column names with backticks:

Parse Value

Format values for SQL:

Automatic parsing

Please note: all column names and values are already automatically parsed, the parseColumn and parseValue methods are for exception use cases.

Get Fields Involved in WHERE

Extract field names from a WHERE clause:

Validation

The QueryBuilder validates queries against your database schema by default:

Disable Validation

Cast NULL Values

When cast_null is enabled, NULL values for NOT NULL columns are automatically converted:

Cast values:

Best Practices

  1. Use validation: Keep validation enabled to catch errors early
  2. Use prepared statements: Always execute queries with PDO prepared statements
  3. Table aliases: Use aliases for complex queries with joins
  4. Specific fields: Select only the fields you need instead of *
  5. Indexes: Ensure WHERE and JOIN columns are indexed
  6. Foreign keys: Define FKs properly to leverage auto-detection in joins

Error Handling

The QueryBuilder throws exceptions for various error conditions:

Common exceptions:

Examples

Pagination

Search with Filters

Complex Join Query

Conditional Update


All versions of query-builder with dependencies

PHP Build Version
Package Version
Requires ext-pdo Version *
model/db-parser Version ^0.2.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 model/query-builder contains the following files

Loading the files please wait ...