Download the PHP package bloatless/query-builder without Composer

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

Bloatless Query Builder

A query builder for PDO MySQL and SQLite.

Installation

Using phar

Download the latest phar from the releases page and include/use the lib in your project like any other PHP class:

Using composer

You can install the library using composer:

Manually

Clone or download the files from GitHub into your local project. You can than include/use the library within your project:

Usage

Query Builder

This documentation explains the complete usage API of the Bloatless Query Builder.

Connections

You can define multiple database connections in your projects config.php file.

Factory

The QueryBuilder factory needs to be initialized using a config array providing the connection credentials:

Once initialized the factory can be used to provide query-builder objects for various database operations:

With no arguments provided the default database connection is used. If you want to use a different connection you can pass the connection name as an argument.

SELECT

A simple select
Table and column alias

Aliases can be used on table names as well as on column names.

Get specific columns
First row only
Single column as array

Will fetch an array containing all first names of the customers table.

You can specify a second column which will be used for the keys of the array:

Will fetch an array of all first names using the customer_id as array key.

Counting rows
Joins

You can join tables using the join, leftJoin or rightJoin methods. You can of course join multiple tables.

Group by
Order by
Having
Limit and Offset
Distinct

UPDATE

DELETE

WHERE

You can use various where clauses on all select, update and delete queries:

Simple where
Or where
Where in
Where not in
Or where in
Or where not in
Where between
Or where between
Where null
Where not null
Or where null
Or where not null
Where raw
Or where raw

INSERT

Single row

When inserting a single row, the auto-increment value of the newly added row will be returned.

Multiple rows

You can insert multiple rows at once using the rows method:

Last insert id

In case you need to fetch the id if the last insert manually you can use the getLastInsertId method:

RAW Queries

There will always be some kind of queries you can not build using the methods of a query builder. In those cases you can utilize the RawQueryBuilder which allows you to execute raw queries to the database.

Raw select queries
Other raw queries

Reset

All query builders have a reset method. This method can be used to clear all previously set values without the need of creating a new QueryBuilder object.

Security

All query builders internally use PDO parameter binding to reduce the risk of injection attacks as much as possible. Additionally, table names as well as field names are quoted - so you don't have to worry about that. This works on simple table names or when using aliases. Nevertheless, you should always try to avoid using user input within sql statements!

License

MIT


All versions of query-builder with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-pdo Version *
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 bloatless/query-builder contains the following files

Loading the files please wait ....