Download the PHP package qstart-soft/query-builder without Composer

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

qstart-soft/query-builder

Library for creating DML (Data Manipulation Language) SQL statements.

Part 1. Basics

Entry point: \ The entry point for creating SQL statements is the Query::class factory.

Creation: \ Getting sql statement and binding parameters:

Expressions: \ Expressions are classes that inherit an \Qstart\Db\QueryBuilder\DML\Expression\ExprInterface interface. \ These classes allow you to create specific expressions for a SQL query.

The initial expression class allows you to pass an immutable expression that will be added to the query without modification

Several other expressions:

It is true that for different SQL dialects the same constructions may have different syntax. \ To do this, you can pass the dialect into the expression.

Part 2. Table format

The table format is the same for all available methods

Available formats (Using the SelectQuery::from() method as an example):

You can also change the alias of the first table for methods:

An example:


Part 3. Conditions format

Any condition can be passed in the following formats:

1. Array with equality conditions.

An array is a key-value pair. The key is the left expression. The value is ine of the options below

2. Any Expression instance of ExprInterface

3. String format

4. Group using the "OR", "AND" "NOT" operators

Then it becomes necessary to combine conditions using the operators AND, OR, NOT. \ All of these combinations have the same format [operator, condition, condition, ...]:

The first in the array must be the operator AND / OR / NOT. \ Next, separated by commas, are conditions in one of three formats (array, expression, string). These conditions can also be in the format with the operator AND / OR / NOT

For example: ['AND', $condition1, $condition2, ['OR', $condition3, $condition4]]

How to use this with a SELECT query, for example:

Part 4. Select Sql Statement

1. Select

To construct a SELECT clause, you need to use methods

The method select() overwrites all previously added values!

The clause can be construct in different formats.

2. Where

To construct a WHERE clause, you need to use methods

The method where() overwrites all previously added values!

All methods accept conditions in the format described above in 'Conditions format'.

You can also use methods that will remove all NULL values from the condition. For Expression instances the method ExprInterface::isEmpty() will be called.

The method filterWhere() overwrites all previously added values!

All methods accept conditions in the format described above in 'Conditions format'.

3. Group By

To construct a GROUP BY clause, you need to use methods

The method groupBy() overwrites all previously added values!

The clause can be construct in different formats.

4. Order By

To construct a ORDER BY clause, you need to use methods

The method orderBy() overwrites all previously added values!

The clause can be construct in different formats.

5. Having

To construct a HAVING clause, you need to use methods

The method having() overwrites all previously added values!

These methods work just look like 'WHERE' methods.

6. OFFSET

To construct a OFFSET clause, you need to use method

Use null value to disable offset. \ The offset may be int|ExprInterface|SelectQuery|null

7. LIMIT

To construct a LIMIT clause, you need to use method

Use null value to disable limit. \ The offset may be int|ExprInterface|SelectQuery|null

8. JOIN

To construct a different JOIN clauses, you need to use method

All these methods accept conditions in the format described above in 'Conditions format'. \ Also, all these methods accept table in the format described above in 'Table format'.

Example of usage:

9. UNION

To use union queries, you need to use method.

ORDER BY clause will be combined from all queries and added to the end of the union queries

The query may be string|ExprInterface|SelectQuery

Part 5. INSERT Sql Statement

Creating the INSERT INTO statement with format: \ INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);

To specify table name use:

To add group of values to a VALUES clause use methods:

To change start or end of statement use methods:

Part 6. UPDATE Sql Statement

1. Table

To specify table name use:

2. SET

To construct a SET clause, you need to use methods

The method set() overwrites all previously added attributes!

Attributes can be passed in different formats. \ If we pass it with the key, we will try to add the value as a query parameter. \ If passed without a key, the value will be a string. \ The value can be passed as a string, an ExprInterface instance, or a QueryInterface instance.

3. Where

To construct a WHERE clause see the description in "Part 3. Select Sql Statement". Format and methods will be completely identical with Select Sql Statement

4. Join

To construct a different JOIN clauses see the description in "Part 3. Select Sql Statement". Format and methods will be completely identical with Select Sql Statement.

5. JOIN FROM

To construct a FROM clause, you need to use method:

Use null value to disable FROM clause

6. Limit

To construct a LIMIT clause see the description in "Part 3. Select Sql Statement". Format and methods will be completely identical with Select Sql Statement

7. Start and end clauses

To change start or end of statement use methods:

Part 7. DELETE Sql Statement

1. From

To specify table name use:

2. Where

To construct a WHERE clause see the description in "Part 3. Select Sql Statement". Format and methods will be completely identical with Select Sql Statement

3. Join

To construct a different JOIN clauses see the description in "Part 3. Select Sql Statement". Format and methods will be completely identical with Select Sql Statement.

4. Using

To construct a USING clause, you need to use method:

Use null value to disable USING clause

5. Limit

To construct a LIMIT clause see the description in "Part 3. Select Sql Statement". Format and methods will be completely identical with Select Sql Statement

6. Start and end clauses

To change start or end of statement use methods:


All versions of query-builder with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.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 qstart-soft/query-builder contains the following files

Loading the files please wait ....