Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpclickhouse Laravel Package

smi2/phpclickhouse

PHP client for ClickHouse with an easy, fluent API. Supports queries and inserts, result sets, bindings, and connection configuration for fast analytics workflows. Suitable for Laravel and standalone PHP apps needing reliable ClickHouse access.

View on GitHub
Deep Wiki
Context7
1.26.610

Bug Fixes

  • Distributed DDL (ON CLUSTER) formatting reworked (#241, #263, #262) — Http::prepareWrite() no longer appends FORMAT JSON to the SQL of ON CLUSTER queries. Instead the response format is requested via the default_format=JSON query setting:
    • CREATE USER / GRANT / ALTER ... ON CLUSTER no longer fail with SYNTAX_ERROR from a stray FORMAT JSON (#241)
    • CREATE / ALTER ... ON CLUSTER results are now parseable JSON again — no more Can't find meta when reading the per-host execution status (#263)
    • a bare ON CLUSTER substring inside INSERT data (e.g. 'REGION CLUSTER') is no longer mistaken for the keyword — \b word boundaries match the real keyword only (#262)
  • False-positive error detection on large JSON responses (#261) — Statement::hasErrorClickhouse() now confirms a tail-regex match with json_validate() (PHP 8.3+) before flagging an error, so valid JSON whose data legitimately contains ClickHouse exception text is not reported as a failure (@jradtilbrook)

Testing

  • New tests/ClickHouse26/OnClusterTest.php — distributed DDL regression tests (CREATE / ALTER / CREATE USER ... ON CLUSTER); skips gracefully when no Keeper/ZooKeeper backend is configured
  • Embedded ClickHouse Keeper added to the test environment (tests/clickhouse-latest-config/keeper.xml, mounted in docker-compose.yaml and copied in CI) so the single-node default cluster can execute ON CLUSTER queries
  • testInsertWithOnClusterInData added to both CH 21 and CH 26 client tests (#262)

Merged PRs

  • #261 — Fix false positive error detection when JSON data contains ClickHouse exception text (@jradtilbrook)

Closed Issues

  • #241 — ALTER / CREATE / DROP / RENAME queries fail when using ON CLUSTER
  • #262 — extra FORMAT JSON in the query when inserting a record (superseded by the default_format fix)
  • #263 — "Can't find meta" error since 1.24.406
1.26.423

2026-04-23 [Release 1.26.423]

Bug Fixes

  • Escape single quotes and backslashes in scalar string native params (#258, #259) — convertParamValue() now escapes \\\ and '\' for scalar String params in selectWithParams() / writeWithParams(). Previously strings like hello\ caused CANNOT_PARSE_ESCAPE_SEQUENCE in ClickHouse (@sander-hash, @tom-on-the-internet)

Testing

  • 5 new native-params tests — scalar strings with trailing backslash, embedded backslash, single quote, injection attempt, and writeWithParams with backslash

Merged PRs

Closed Issues

  • #258 — Scalar string params are not escaped, causing CANNOT_PARSE_ESCAPE_SEQUENCE
1.26.417

2026-04-17 [Release 1.26.417]

Bug Fixes

  • Correctly encode arrays for native param binding (#257) — convertParamValue() now produces ClickHouse-compatible array literals ['foo','bar'] (single quotes) instead of JSON format ["foo","bar"]. Previously any Array(String) parameter in selectWithParams() / writeWithParams() failed with a parse error (@sander-hash)
  • Escape single quotes and backslashes in array strings — follow-up to #257. Strings containing ' or \ are now properly escaped (e.g. "it's"'it\'s'), preventing query errors and array-element injection

Testing

  • 6 new native-params tests — cover Array(UInt32), Array(String), empty arrays, strings with single quotes, strings with backslashes, and injection attempts

Merged PRs

  • #257 — Correctly encode array for native param binding (@sander-hash)
1.26.412

2026-04-12 [Release 1.26.412]

Bug Fixes

  • Fix bindParams() TypeError with numeric keys (#256) — bindParams() now casts integer array keys to string before passing to bindParam(string $column), restoring backward compatibility with numerically-indexed arrays. Affected downstream packages like phpclickhouse-laravel (@yehezkel-fullpath)

Testing

  • Flaky tests excluded from default runstestConnectTimeout, testStreamInsert, testStreamInsertFormatJSONEachRow marked [@group](https://github.com/group) flaky and excluded via PHPUnit config. Run separately with ./vendor/bin/phpunit --group flaky
  • 2 new binding teststestBindParamsWithNumericKeys, testBindParamsWithMixedKeys covering #256 regression

Closed Issues

  • #256 — Breaking change: strict string type on Bindings::bindParam() rejects integer keys
1.26.410

2026-04-10 [Release 1.26.410]

New Features

  • readWithParams() (#254) — stream query results with native ClickHouse typed parameters ({name:Type} syntax), combining server-side parameter binding with streaming output (@sander-hash)

Code Quality

  • Stringable interfaces (#252) — all Type classes now explicitly implement Stringable for consistency (@sander-hash)
  • PHPStan test fixes (#253) — removed redundant assertions in static tests, improved assertion quality (@sander-hash)
  • Documentation sync — updated GitHub Pages (docs/) with readWithParams() in native-params, streaming, and per-query-settings guides

Merged PRs

  • #252 — Add Stringable interfaces for types (@sander-hash)
  • #253 — Fix phpstan errors in test files (@sander-hash)
  • #254 — Added native params for read function (@sander-hash)
1.26.406

2026-04-06 [Release 1.26.406]

WARNING : PHP 8.1+

New Features

  • Boolean Type (#251) — new ClickHouseDB\Type\Boolean class with fromString(), fromBool(), getValue(), __toString() (@sander-hash)

Code Quality

  • PHP 8.1+ native type declarations — full migration across all 33 src/ files: property types, parameter types, return types. Interfaces (Degeneration, IStream, Type) unchanged for backward compatibility
  • PR Security Review rules — added supply-chain attack detection checklist to CLAUDE.md (outbound network calls, data exfiltration, obfuscation, credential leakage patterns)
  • Security audit — full code audit of src/, results saved in secure-scan.md. All clean: no backdoors, exfiltration, or obfuscation found

Testing

  • 153 new static unit tests — run without ClickHouse server:
    • ValueFormatterTest (28) — SQL escaping, types, DateTimeInterface, Expression
    • StrictQuoteLineTest (32) — CSV/TSV/Insert formatting, encodeString
    • SettingsTest (24) — get/set/is, sessions, timeouts, readonly
    • WriteToFileTest (15) — file validation, formats, gzip
    • TypesTest (26+5) — UInt64, DateTime64, MapType, TupleType, Boolean and more
    • BindingsUnitTest (16) — compile_binds, Conditions {if}/{else}
    • CurlerRequestResponseTest (35) — headers, auth, URL, JSON, dump
  • Total: 313+ tests (CH 21.9 + CH 26.3 + static), all passing

Merged PRs

1.26.4

2026-04-04 [Release 1.26.4]

Many changes see change.log

1.6.0

2025-01-14 [Release 1.6.0]

  • Support php 8
  • And some pr & fixes
1.5.3

2024-01-18 [Release 1.5.3]

  • Fix release 1.5.2
  • Support php 7
  • Update Statement.php #204
  • fix(#202): Fix converting boolean when inserting into int and fix(#194): Fix unexpected readonly mode with specific string in query #203
  • Update README.md #199
  • remove dev files for --prefer-dist #192
1.5.2

2024-01-16 [Release 1.5.2]

  • Update Statement.php #204
  • fix(#202): Fix converting boolean when inserting into int and fix(#194): Fix unexpected readonly mode with specific string in query #203
  • Update README.md #199
  • remove dev files for --prefer-dist #192
1.5.1

BREAKING CHANGES

  • Post type bindings support

SELECT number+{num_num:UInt8} as numbe_r, {xpx1:UInt32} as xpx1,{zoza:String} as zoza FROM system.numbers LIMIT 6

1.5.0

2022-12-21 [Release 1.5.0]

  • Change exceptionCode in Clickhouse version 22.8.3.13 (official build) #180

  • Fix Docker for tests, Change the correct Docker image name #177

  • Some type fix

  • Fix types: max_execution_time & setConnectTimeOut, undo: Support floats in timeout and connect_timeout #173

  • add mbstring to composer require #183

  • fixed progressFunction #182

  • Add allow_plugins setting since Composer 2.2.x #178

  • Re upload 1.5.0 - hot fix types error

1.4.6

2022-06-22 [Release 1.4.6]

  • Return type of ClickHouseDB\Statement::current() should either be compatible with Iterator::current() #170
1.4.4

2022-04-23 [Release 1.4.4]

  • Fix ping() for windows users
  • ping(true) throw TransportException if can`t connect/ping
1.4.3

2022-04-20 [Release 1.4.3]

  • Fix: prevent enable_http_compression parameter from being overridden #164
  • For correct work with utf-8 . I am working on server with PHP 5.6.40 Update CurlerRequest.php #158
  • Add curl setStdErrOut, for custom StdOutErr.
  • Fix some test for check exceptions
1.4.2

2022-02-11 [Release 1.4.2]

  • Fixed issue with non-empty raw data processing during init() on every fetchRow() and fetchOne() call - PR #161
1.4.1

2021-01-19 [Release 1.4.1]

  • Add support php 7.3 & php 8
1.3.10

2019-09-29 [Release 1.3.10]

Add two new types of authentication #139 Fixed typo in streamRead exception text #140 fix the exception(multi-statement not allow) when sql end with ';' #138 Added more debug info for empty response with error #135

1.3.9

2020-02-03 [Release 1.3.9]

  • #134 Enhancement: Add a new exception to be able to distinguish that ClickHouse is not available.
1.3.8

2020-01-17 [Release 1.3.8]

  • #131 Fix: async loop breaks after 20 seconds
  • #129 Add client certificate support to able to work with Yandex ClickHouse cloud hosting
  • Delete dropOldPartitions
  • Fix error : The error of array saving #127
  • More test
1.3.7

2019-09-20 [Release 1.3.7]

  • #125 WriteToFile: support for JSONEachRow format
1.3.6

2019-04-29 [Release 1.3.6]

  • #122 Add function fetchRow()
  • Use X-ClickHouse-User by headers
  • Add setDirtyCurler() in HTTP
  • Add more tests
1.3.5

2019-04-29 [Release 1.3.4]

  • #118 Fix Error in Conditions & more ConditionsTest
  • Fix phpStan warnings in getConnectTimeOut() & max_execution_time()
1.3.3

2019-04-25 [Release 1.3.3]

  • fix clickhouse release 19.5.2.6 error parsing #117
  • chore(Travis CI): Enable PHP 7.3 testing #116
1.3.2

2019-03-18 [Release 1.3.2]

  • fix: add CSVWithNames to supported formats #107
  • Upgraded Expression proposal #106 -> UUIDStringToNum
  • Correct query format parsing #108
  • Can not use numbers() function in read requests #110
  • #109 Do not use keep-alive or reuse them across requests
1.3.1

2018-09-25 [Release 1.3.1]

  • Pull request #94 from simPod: Uint64 values
  • Pull request #95 from simPod: Bump to php 7.1
1.2.4

2018-09-11 [Release 1.2.4]

  • Fix #91 ,Does not work inserting with the database name in the table
  • pull request #90 from simPod: Refactor partitions()
1.2.3

2018-08-30 [Release 1.2.3]

  • Escape values in arrays, pull request #87 from simPod/fix-escape
  • fix-bindings: pull request #84 from simPod/fix-bindings
  • Added quotes arount table and column names in the insert wrapper.
  • Docker Compose in tests
1.2.2
  • Connection without port
1.2.1

Release 1.2.1

  • New $client->getServerVersion()
  • Rewrite method $client->ping()
  • Fix include.php - ClickHouseException before exceptions
  • Add CHANGELOG.md
  • New interface ClickHouseException
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views