Download the PHP package ysfkc/clickhouse without Composer

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

ysfkc/clickhouse

A lightweight, framework-agnostic ClickHouse HTTP client for PHP 8.1+ with a fluent QueryBuilder and an ORM-style model layer.

PHP

Table of Contents


Architecture


Installation

Requirements: PHP 8.1+, guzzlehttp/guzzle ^7.0, psr/log ^1|^2|^3


Configuration

Step 1 — Configure once at bootstrap

Call ClickHouseClientService::configure() once at application startup (service provider, bootstrap file, etc.):

With a PSR-3 logger:


Step 2 — Obtain the client via getInstance()

After configure() is called, retrieve the shared ClickHouseClient instance from anywhere in your application:

getInstance() creates the client lazily on the first call and returns the same instance on every subsequent call. Calling configure() again invalidates the old instance and forces a fresh one on the next getInstance() call.

⚠️ Calling getInstance() before configure() throws a \RuntimeException.


Step 3 — Use the client directly or via QueryBuilder / Model

Once configured, you can use any of the three layers — they all resolve the client internally via getInstance():


Optional — Inject a PSR-3 logger for models


QueryBuilder

QueryBuilder is started via the static table() method. All methods support fluent chaining.

SELECT


WHERE Conditions

Basic Equality

Comparison Operators

IN / NOT IN

BETWEEN (Date Range)

NULL Checks

whereRaw — Raw Condition

⚠️ Use only when where() cannot express the condition. Never embed user input directly — use QueryBuilder::raw() with parameters instead.


JOIN


GROUP BY / HAVING


ORDER BY / LIMIT / OFFSET

First Row

COUNT


INSERT

Single Row

Batch INSERT


Raw Query — raw()

For complex queries that cannot be expressed with the structured methods:

Debug — toSql()


Model System (ORM)

Defining a Model


Querying Records

all() — All Records

find() — Conditional Query

findFirst() — First Record

countBy() — Count

query() — Advanced Fluent Query

queryBetweenDates() — Date Range Shorthand


Inserting Records

insertRow() — Single Row

insertBatch() — Bulk Insert


rawQuery / rawCommand

rawQuery — Custom SELECT

⚠️ Pass only hardcoded strings as $query. All dynamic values must go through $params.

rawCommand — DDL Commands


ClickHouseResponse


ClickHouseCollection


Direct Client Usage


Security

Parameterized Queries

All user-supplied values are sent as param_* query string parameters, never interpolated into the SQL body:

Blocked Vectors

Category Examples
Statement chaining ; separator
DDL DROP, ALTER, CREATE, TRUNCATE
DML (external) INSERT INTO, DELETE FROM
SSRF url(), remote(), s3(), hdfs()
LFI file()
Schema discovery SHOW TABLES, DESCRIBE
Exfiltration INTO OUTFILE, clusterAllReplicas(), dictGet()
Time-based sleep(), benchmark()
Subquery (whereRaw/having/join) (SELECT …)

Rule: whereRaw / having / join Conditions


ClickHouse Type Reference

Type Description Example
String UTF-8 text 'click'
Int8 / Int16 / Int32 / Int64 Signed integer 123
UInt8 / UInt16 / UInt32 / UInt64 Unsigned integer 456
Float32 / Float64 Floating-point 3.14
Date Date YYYY-MM-DD '2026-04-06'
DateTime Datetime YYYY-MM-DD HH:MM:SS '2026-04-06 12:00:00'
DateTime64(3) Millisecond-precision datetime '2026-04-06 12:00:00.123'
Nullable(Int32) Nullable Int32 null or 123
Array(String) String array — for IN ['a', 'b']
Array(Int32) Int32 array — for IN [1, 2, 3]
LowCardinality(String) Low-cardinality string 'ok'

Note: The Array(…) wrapper is added automatically for IN / NOT IN. ->where('status', 'IN', ['ok', 'warning', 'error'], 'String')status IN {p:Array(String)}


Phalcon Integration (Optional)

If you use this package inside a Phalcon application, bridge the Phalcon logger to PSR-3 using the included optional adapter:


License

MIT


All versions of clickhouse with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
guzzlehttp/guzzle Version ^6.0.0|^7.4.5
psr/log Version ^1.0 || ^2.0 || ^3.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 ysfkc/clickhouse contains the following files

Loading the files please wait ...