Query builder
Chain SELECT, INSERT, and aggregate queries, with parameter binding instead of string concatenation.
ClickHouse / PHP
Query builder, schema, migrations, and ORM in one package, with one API across six frameworks.
clickhouse-php connects to ClickHouse over HTTP, bringing query building, schema management, migrations, and ORM into a single package.
The same calls run in plain PHP, Laravel, Webman, ThinkPHP, Hyperf, Yii2, and Yii3, with no need to rewrite business code per framework.
A round yellow cartoon hamster wearing a PHP purple scarf and a yellow ClickHouse house tag, waving its right paw in greeting.
Queries, tables, migrations: leave them to me.Build, create tables, migrate, and map, all in one namespace.
Chain SELECT, INSERT, and aggregate queries, with parameter binding instead of string concatenation.
Describe table structure in PHP, with columns, indexes, and engines written in one place.
Versioned migration files with run, rollback, and refresh.
ActiveRecord models and read-only collections, keeping the flexibility of raw queries.
Multiple connections with Swoole, Swow, and Workerman coroutine pools; FPM connects directly.
Laravel, Webman, ThinkPHP, Hyperf, Yii2, and Yii3 share the same core.
Four releases that filled in queries, schema, migrations, and framework support.
Improves streaming response parsing and version release checks, and fills in documentation.
Moves pet forms into the Pet API, and they now appear in command output.
Adds the Yii2 application component and Yii3 DI integration, bringing framework support to six.
Fixes issues found in review and adds streaming reads plus query-level SETTINGS.
Click an image to enlarge.
Install first, then run a minimal example.
composer require erikwang2013/clickhouse-phpuse Erikwang2013\ClickHouse\ClickHouse;
ClickHouse::bootstrap();
$rows = ClickHouse::table('logs')
->where('date', '>=', '2024-01-01')
->whereIn('level', ['error', 'warn'])
->orderBy('timestamp', 'desc')
->limit(100)
->get();
foreach ($rows as $row) {
echo $row['message'];
}Hover for a moment and its mood changes.