Download the PHP package requtize/query-builder without Composer
On this page you can find all versions of the php package requtize/query-builder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download requtize/query-builder
More information about requtize/query-builder
Files in requtize/query-builder
Package query-builder
Short Description Fast, simple and dependency-free query builder for PHP.
License MIT
Homepage https://github.com/requtize/query-builder
Informations about the package query-builder
QueryBuilder
Query Builder is a fast, simple, methods-chaining, dependency-free library to create SQL Queries simple and fast to write, extend and manage. Supports databases which are supported by PDO. Can be also used as Database Abstraction Layer.
Installation - via composer.json
Usage whith connection estabilished before, in some other system's part.
Query Builder Methods
Table selection
Selects
Wheres
If method not starts with "or*, multiple calls will join it as "AND".
Wheres (all methods above) can also take Closure as first argument. This can make sub-criterias. Sub-criterias will be joined to main query using joined from used method. As argument of the anonymous function is object NestedCriteria that allows You to use all the where() methods above.
Wheres can also take as first argument RAW query section in two ways. First - all full criteria (column name, operator and value), or only columns/table-column value n first parameter, and value as second.
Joins
Resutls set
Inserts
If insert call operate on table with AUTO_INCREMENT column, method will return inserted ID of row. Also You can use another method (after call insert()
method) to do the same thing:
Update
Delete
RAW values
In most of all methods and parameters You can pass the RAW value as argument. To do this You have to only use raw() method and pass the result of this method to any argument You want.
Raw query
Sub-Queries and Nested Queries
In some cases You might need to create SubQuery to provide some special functionality. Use the subQuery() method to do this thing. Examples of usage:
Generated query by Query Builder.
Get compiled Query
If You want to preview a query, before execution, or for debugging intensions, You may want use getQuery() method, which returns Query object, with compiled query (with placeholders), array of bindings and the PDO instance. This object contains all data of current Query Builder instance.
API
@todo
-
Where LIKE
-
Scopes - reusable predefined groups of statements.
-
Chunks of returned rows Must work only when there's no defined LIMIT statement!
-
Inserting data as aggregated collection
- Fulltext search