Download the PHP package esazykin/clickhouse-builder without Composer

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

Clickhouse Query Builder

Build Status Coverage Status

Requirements

php 7.1

Install

Via composer

Usage

For working query builder we must previously instantiate and pass in constructor the-tinderbox/clickhouse-php-client.

After that we can build and perform sql queries.

Select columns

All this calls will be transformed into next sql:

Also, as a column we can pass closure. In this case in closure will be passed instance of Column class, inside which we can setup column how we want. This can be useful for difficult expressions with many functions, subqueries and etc.

Will be compiled in:

Will be compiled in:

Same behavior can be also achieved by any of the following approaches:

Notice! Functions on columns is not stable and under development.

From

Produce the following query:

Also can be passed closure or builder as argument for performing sub query.

or

or

or

It is all variants of the same sql query which was listed above.

Sample coefficient

I think there no need for additional words)

Joins

For performing subquery as first argument you can pass closure or builder.

Also there are many helper functions with hardcoded arguments, like strict or type and they combinations.

Temporary tables usage

There are some cases when you need to filter f.e. users by their ids, but amount of ids is huge. You can store users ids in local file, upload it to server and use it as temporary table.

Will produce:

If you want tables to be detected automatically, call addFile method before calling whereIn.

You can use local files in whereIn, prewhereIn, havingIn and join statements of query builder.

Prewhere, where, having

All example will be about where, but same behavior also is for prewhere and having.

All string values will be wrapped with single quotes. If operator is not provided = will be used. If operator is not provided and value is an array, then IN will be used.

If in the first argument was passed closure, then all wheres statements from inside will be wrapped with parenthesis. But if on that builder (inside closure) will be specified from then it will be transformed into subquery.

Almost same is for value parameter, except wrapping into parenthesis. Any closure or builder instance passed as value will be converted into subquery.

Also you can pass internal representation of this statement and it will be used. I will no talk about this with deeper explanation because its not preferable way to use this.

Like joins there are many helpers with hardcoded parameters.

Also there is method to make where by dictionary:

If you want to use complex key, you may pass an array as $key, then array will be converted to tuple. By default all strings will be escaped by single quotes, but you may pass an Identifier instance to pass for example column name:

Will produce:

Group By

Works like select.

Final query will be like:

Order By

In the example above, third argument is optional

Aliases:

For column there are same behaviour like in select method.

Limit

There are two types of limit. Limit and limit n by.

Limit n by:

Will produce:

Simple limit:

Will produce:

SELECT * FROM `table` LIMIT 100, 10

Union ALL

In unionAll method can be passed closure or builder instance. In case of closure inside will be passed builder instance.

Performing request and getting result.

After building request you must call get() method for sending request to the server. Also there has opportunity to make asynchronous requests. Its works almost like unionAll.

This callings will produce the same behavior. Two queries which will be executed asynchronous. Now, if you call get() method, as result will be returned array, where numeric index correspond to the result of request with this number.


All versions of clickhouse-builder with dependencies

PHP Build Version
Package Version
Requires php Version ~7.1
myclabs/php-enum Version ^1.5
the-tinderbox/clickhouse-php-client Version ^1.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 esazykin/clickhouse-builder contains the following files

Loading the files please wait ....