PHPackages                             glutwins/phpclickhouse - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. glutwins/phpclickhouse

ActiveLibrary[HTTP &amp; Networking](/categories/http)

glutwins/phpclickhouse
======================

PHP ClickHouse Client

1.4.7(2y ago)01.7kMITPHPPHP ^7.1

Since Sep 11Pushed 2y agoCompare

[ Source](https://github.com/glutwins/phpClickHouse)[ Packagist](https://packagist.org/packages/glutwins/phpclickhouse)[ Docs](https://github.com/glutwins/phpClickHouse)[ RSS](/packages/glutwins-phpclickhouse/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (7)Dependencies (4)Versions (18)Used By (0)

PHP ClickHouse wrapper
======================

[](#php-clickhouse-wrapper)

[![Build Status](https://camo.githubusercontent.com/2eb44417989d253a83bbf7c58fd0fa0afdbbbd94c1e6f57605d74e799f9a3281/68747470733a2f2f7472617669732d63692e6f72672f736d69322f706870436c69636b486f7573652e737667)](https://travis-ci.org/smi2/phpClickHouse)[![Downloads](https://camo.githubusercontent.com/bf19c6cef027523028218472af302aef548eac7bfb7b0ce2c45d93f9668d1b27/68747470733a2f2f706f7365722e707567782e6f72672f736d69322f706870436c69636b486f7573652f642f746f74616c2e737667)](https://packagist.org/packages/smi2/phpClickHouse)[![Packagist](https://camo.githubusercontent.com/de8da63d16f846e42152bd24786b1949a0338bcecec9f2a389244c865b5f77fb/68747470733a2f2f706f7365722e707567782e6f72672f736d69322f706870436c69636b486f7573652f762f737461626c652e737667)](https://packagist.org/packages/smi2/phpClickHouse)[![Licence](https://camo.githubusercontent.com/bd312597937bc9770d869e8336184e89642a8ba7c5c4e3413c671cfac4e189c6/68747470733a2f2f706f7365722e707567782e6f72672f736d69322f706870436c69636b486f7573652f6c6963656e73652e737667)](https://packagist.org/packages/smi2/phpClickHouse)[![Quality Score](https://camo.githubusercontent.com/12ddce98a231e454b40c947e344d04ca36ab8764c6c26ce1d7452abf2ce05fb4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f736d69322f706870436c69636b486f7573652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/smi2/phpClickHouse)[![Code Coverage](https://camo.githubusercontent.com/7c87088442bc4650c16ee35a3d207c126b30bbe83b24774ada0f6aaaef3f00a4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f736d69322f706870436c69636b486f7573652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/smi2/phpClickHouse)

Features
--------

[](#features)

- No dependency, only Curl (support php `>=7.1` )
- Select parallel queries (asynchronous)
- Asynchronous bulk inserts from CSV file
- Http compression (Gzip), for bulk inserts
- Find active host, check cluster
- Select WHERE IN ( *local csv file* )
- SQL conditions &amp; template
- tablesSize &amp; databaseSize
- listPartitions
- truncateTable in cluster
- Insert array as column
- Get master node replica in cluster
- Get tableSize in all nodes
- Async get ClickHouse progress function
- streamRead/Write &amp; Closure functions

[Russian articles habr.com 1](https://habrahabr.ru/company/smi2/blog/317682/) [on habr.com 2](https://habr.com/company/smi2/blog/314558/)

Install composer
----------------

[](#install-composer)

```
composer require smi2/phpclickhouse

```

In php

```
// vendor autoload
$db = new ClickHouseDB\Client(['config_array']);
$db->ping();
```

Last stable version for:

- php 5.6 = `1.1.2`
- php 7.0 = `1.2.4`

[Packagist](https://packagist.org/packages/smi2/phpclickhouse)

Start
-----

[](#start)

Connect and select database:

```
$config = [
    'host' => '192.168.1.1',
    'port' => '8123',
    'username' => 'default',
    'password' => ''
];
$db = new ClickHouseDB\Client($config);
$db->database('default');
$db->setTimeout(1.5);      // 1500 ms
$db->setTimeout(10);       // 10 seconds
$db->setConnectTimeOut(5); // 5 seconds
```

Show tables:

```
print_r($db->showTables());
```

Create table:

```
$db->write('
    CREATE TABLE IF NOT EXISTS summing_url_views (
        event_date Date DEFAULT toDate(event_time),
        event_time DateTime,
        site_id Int32,
        site_key String,
        views Int32,
        v_00 Int32,
        v_55 Int32
    )
    ENGINE = SummingMergeTree(event_date, (site_id, site_key, event_time, event_date), 8192)
');
```

Show create table:

```
echo $db->showCreateTable('summing_url_views');
```

Insert data:

```
$stat = $db->insert('summing_url_views',
    [
        [time(), 'HASH1', 2345, 22, 20, 2],
        [time(), 'HASH2', 2345, 12, 9,  3],
        [time(), 'HASH3', 5345, 33, 33, 0],
        [time(), 'HASH3', 5345, 55, 0, 55],
    ],
    ['event_time', 'site_key', 'site_id', 'views', 'v_00', 'v_55']
);
```

If you need to insert UInt64 value, you can wrap the value in `ClickHouseDB\Type\UInt64` DTO.

```
$statement = $db->insert('table_name',
    [
        [time(), UInt64::fromString('18446744073709551615')],
    ],
    ['event_time', 'uint64_type_column']
);
UInt64::fromString('18446744073709551615')
```

Select:

```
$statement = $db->select('SELECT * FROM summing_url_views LIMIT 2');
```

Work with Statement:

```
// Count select rows
$statement->count();

// Count all rows
$statement->countAll();

// fetch one row
$statement->fetchOne();

// get extremes min
print_r($statement->extremesMin());

// totals row
print_r($statement->totals());

// result all
print_r($statement->rows());

// totalTimeRequest
print_r($statement->totalTimeRequest());

// raw answer JsonDecode array, for economy memory
print_r($statement->rawData());

// raw curl_info answer
print_r($statement->responseInfo());

// human size info
print_r($statement->info());

// if clickhouse-server version >= 54011
$db->settings()->set('output_format_write_statistics',true);
print_r($statement->statistics());
```

Select result as tree:

```
$statement = $db->select('
    SELECT event_date, site_key, sum(views), avg(views)
    FROM summing_url_views
    WHERE site_id < 3333
    GROUP BY event_date, url_hash
    WITH TOTALS
');

print_r($statement->rowsAsTree('event_date.site_key'));

/*
(
    [2016-07-18] => Array
        (
            [HASH2] => Array
                (
                    [event_date] => 2016-07-18
                    [url_hash] => HASH2
                    [sum(views)] => 12
                    [avg(views)] => 12
                )
            [HASH1] => Array
                (
                    [event_date] => 2016-07-18
                    [url_hash] => HASH1
                    [sum(views)] => 22
                    [avg(views)] => 22
                )
        )
)
*/
```

Drop table:

```
$db->write('DROP TABLE IF EXISTS summing_url_views');
```

Features
--------

[](#features-1)

### Select parallel queries (asynchronous)

[](#select-parallel-queries-asynchronous)

```
$state1 = $db->selectAsync('SELECT 1 as ping');
$state2 = $db->selectAsync('SELECT 2 as ping');

// run
$db->executeAsync();

// result
print_r($state1->rows());
print_r($state2->fetchOne('ping'));
```

### Parallelizing massive inserts from CSV file

[](#parallelizing-massive-inserts-from-csv-file)

```
$file_data_names = [
    '/tmp/clickHouseDB_test.1.data',
    '/tmp/clickHouseDB_test.2.data',
    '/tmp/clickHouseDB_test.3.data',
    '/tmp/clickHouseDB_test.4.data',
    '/tmp/clickHouseDB_test.5.data',
];

// insert all files
$stat = $db->insertBatchFiles(
    'summing_url_views',
    $file_data_names,
    ['event_time', 'site_key', 'site_id', 'views', 'v_00', 'v_55']
);
```

### Parallelizing errors

[](#parallelizing-errors)

selectAsync without executeAsync

```
$select = $db->selectAsync('SELECT * FROM summing_url_views LIMIT 1');
$insert = $db->insertBatchFiles('summing_url_views', ['/tmp/clickHouseDB_test.1.data'], ['event_time']);
// 'Exception' with message 'Queue must be empty, before insertBatch, need executeAsync'
```

see example/exam5\_error\_async.php

### Gzip &amp; enable\_http\_compression

[](#gzip--enable_http_compression)

On fly read CSV file and compress zlib.deflate.

```
$db->settings()->max_execution_time(200);
$db->enableHttpCompression(true);

$result_insert = $db->insertBatchFiles('summing_url_views', $file_data_names, [...]);

foreach ($result_insert as $fileName => $state) {
    echo $fileName . ' => ' . json_encode($state->info_upload()) . PHP_EOL;
}
```

see speed test `example/exam08_http_gzip_batch_insert.php`

### Max execution time

[](#max-execution-time)

```
$db->settings()->max_execution_time(200); // second
```

### Connection without port

[](#connection-without-port)

```
$config['host']='blabla.com';
$config['port']=0;
// getUri() === 'http://blabla.com'

$config['host']='blabla.com/urls';
$config['port']=8765;
// getUri() === 'http://blabla.com/urls'

$config['host']='blabla.com:2224';
$config['port']=1234;
// getUri() === 'http://blabla.com:2224'

```

### tablesSize &amp; databaseSize

[](#tablessize--databasesize)

Result in *human size*

```
print_r($db->databaseSize());
print_r($db->tablesSize());
print_r($db->tableSize('summing_partions_views'));
```

### Partitions

[](#partitions)

```
$count_result = 2;
print_r($db->partitions('summing_partions_views', $count_result));
```

### Select WHERE IN ( *local csv file* )

[](#select-where-in--local-csv-file-)

```
$file_name_data1 = '/tmp/temp_csv.txt'; // two column file [int,string]
$whereIn = new \ClickHouseDB\Query\WhereInFile();
$whereIn->attachFile($file_name_data1, 'namex', ['site_id' => 'Int32', 'site_hash' => 'String'], \ClickHouseDB\Query\WhereInFile::FORMAT_CSV);
$result = $db->select($sql, [], $whereIn);

// see example/exam7_where_in.php
```

### Bindings

[](#bindings)

Bindings:

```
$date1 = new DateTime("now"); // DateTimeInterface

$Bindings = [
  'select_date' => ['2000-10-10', '2000-10-11', '2000-10-12'],
  'datetime'=>$date,
  'limit' => 5,
  'from_table' => 'table'
];

$statement = $db->selectAsync("SELECT FROM {table} WHERE datetime=:datetime limit {limit}", $Bindings);

// Double bind in {KEY}
$keys=[
            'A'=>'{B}',
            'B'=>':C',
            'C'=>123,
            'Z'=>[':C',':B',':C']
        ];
$this->client->selectAsync('{A} :Z', $keys)->sql() // ==   "123 ':C',':B',':C' FORMAT JSON",
```

#### Simple sql conditions &amp; template

[](#simple-sql-conditions--template)

Conditions is deprecated, if need use: `$db->enableQueryConditions();`

Example with QueryConditions:

```
$db->enableQueryConditions();

$input_params = [
  'select_date' => ['2000-10-10', '2000-10-11', '2000-10-12'],
  'limit' => 5,
  'from_table' => 'table'
];

$select = '
    SELECT * FROM {from_table}
    WHERE
    {if select_date}
        event_date IN (:select_date)
    {else}
        event_date=today()
    {/if}
    {if limit}
    LIMIT {limit}
    {/if}
';

$statement = $db->selectAsync($select, $input_params);
echo $statement->sql();

/*
SELECT * FROM table
WHERE
event_date IN ('2000-10-10','2000-10-11','2000-10-12')
LIMIT 5
FORMAT JSON
*/

$input_params['select_date'] = false;
$statement = $db->selectAsync($select, $input_params);
echo $statement->sql();

/*
SELECT * FROM table
WHERE
event_date=today()
LIMIT 5
FORMAT JSON
*/

$state1 = $db->selectAsync(
    'SELECT 1 as {key} WHERE {key} = :value',
    ['key' => 'ping', 'value' => 1]
);

// SELECT 1 as ping WHERE ping = "1"
```

Example custom query Degeneration in `exam16_custom_degeneration.php`

```
SELECT {ifint VAR} result_if_intval_NON_ZERO{/if}
SELECT {ifint VAR} result_if_intval_NON_ZERO {else} BLA BLA{/if}

```

### Settings

[](#settings)

3 way set any settings

```
// in array config
$config = [
    'host' => 'x',
    'port' => '8123',
    'username' => 'x',
    'password' => 'x',
    'settings' => ['max_execution_time' => 100]
];
$db = new ClickHouseDB\Client($config);

// settings via constructor
$config = [
    'host' => 'x',
    'port' => '8123',
    'username' => 'x',
    'password' => 'x'
];
$db = new ClickHouseDB\Client($config, ['max_execution_time' => 100]);

// set method
$config = [
    'host' => 'x',
    'port' => '8123',
    'username' => 'x',
    'password' => 'x'
];
$db = new ClickHouseDB\Client($config);
$db->settings()->set('max_execution_time', 100);

// apply array method
$db->settings()->apply([
    'max_execution_time' => 100,
    'max_block_size' => 12345
]);

// check
if ($db->settings()->getSetting('max_execution_time') !== 100) {
    throw new Exception('Bad work settings');
}

// see example/exam10_settings.php
```

### Use session\_id with ClickHouse

[](#use-session_id-with-clickhouse)

`useSession()` - make new session\_id or use exists `useSession(value)`

```
// enable session_id
$db->useSession();
$sesion_AA=$db->getSession(); // return session_id

$db->write(' CREATE TEMPORARY TABLE IF NOT EXISTS temp_session_test (number UInt64)');
$db->write(' INSERT INTO temp_session_test SELECT number*1234 FROM system.numbers LIMIT 30');

// reconnect to continue with other session
$db->useSession($sesion_AA);
```

### Array as column

[](#array-as-column)

```
$db->write('
    CREATE TABLE IF NOT EXISTS arrays_test_string (
        s_key String,
        s_arr Array(String)
    )
    ENGINE = Memory
');

$db->insert('arrays_test_string',
    [
        ['HASH1', ["a", "dddd", "xxx"]],
        ['HASH1', ["b'\tx"]],
    ],
    ['s_key', 's_arr']
);

// see example/exam12_array.php
```

Class for FormatLine array

```
var_dump(
    ClickHouseDB\Quote\FormatLine::CSV(
        ['HASH1', ["a", "dddd", "xxx"]]
    )
);

var_dump(
    ClickHouseDB\Quote\FormatLine::TSV(
        ['HASH1', ["a", "dddd", "xxx"]]
    )
);

// example write to file
$row=['event_time'=>date('Y-m-d H:i:s'),'arr1'=>[1,2,3],'arrs'=>["A","B\nD\nC"]];
file_put_contents($fileName,ClickHouseDB\Quote\FormatLine::TSV($row)."\n",FILE_APPEND);
```

### Cluster drop old Partitions

[](#cluster-drop-old-partitions)

Example code :

```
class my
{
    /**
     * @return \ClickHouseDB\Cluster
     */
    public function getClickHouseCluster()
    {
            return $this->_cluster;
    }

    public function msg($text)
    {
            echo $text."\n";
    }

    private function cleanTable($dbt)
    {

        $sizes=$this->getClickHouseCluster()->getSizeTable($dbt);
        $this->msg("Clean table : $dbt,size = ".$this->humanFileSize($sizes));

        // split string "DB.TABLE"
        list($db,$table)=explode('.',$dbt);

        // Get Master node for table
        $nodes=$this->getClickHouseCluster()->getMasterNodeForTable($dbt);
        foreach ($nodes as $node)
        {
            $client=$this->getClickHouseCluster()->client($node);

            $size=$client->database($db)->tableSize($table);

            $this->msg("$node \t {$size['size']} \t {$size['min_date']} \t {$size['max_date']}");

            $client->dropOldPartitions($table,30,30);
        }
    }

    public function clean()
    {
        $this->msg("clean");

        $this->getClickHouseCluster()->setScanTimeOut(2.5); // 2500 ms
        $this->getClickHouseCluster()->setSoftCheck(true);
        if (!$this->getClickHouseCluster()->isReplicasIsOk())
        {
            throw new Exception('Replica state is bad , error='.$this->getClickHouseCluster()->getError());
        }

        $this->cleanTable('model.history_full_model_sharded');

        $this->cleanTable('model.history_model_result_sharded');
    }
}
```

### HTTPS

[](#https)

```
$db = new ClickHouseDB\Client($config);
$db->settings()->https();
```

### getServer System.Settings &amp; Uptime

[](#getserver-systemsettings--uptime)

```
print_r($db->getServerUptime());

print_r($db->getServerSystemSettings());

print_r($db->getServerSystemSettings('merge_tree_min_rows_for_concurrent_read'));
```

### ReadOnly ClickHouse user

[](#readonly-clickhouse-user)

```
$config = [
    'host' => '192.168.1.20',
    'port' => '8123',
    'username' => 'ro',
    'password' => 'ro',
    'readonly' => true
];
```

### Direct write to file

[](#direct-write-to-file)

Send result from clickhouse, without parse json.

```
$WriteToFile=new ClickHouseDB\WriteToFile('/tmp/_1_select.csv');
$db->select('select * from summing_url_views',[],null,$WriteToFile);
// or
$db->selectAsync('select * from summing_url_views limit 4',[],null,new ClickHouseDB\WriteToFile('/tmp/_3_select.tab',true,'TabSeparatedWithNames'));
$db->selectAsync('select * from summing_url_views limit 4',[],null,new ClickHouseDB\WriteToFile('/tmp/_4_select.tab',true,'TabSeparated'));
$statement=$db->selectAsync('select * from summing_url_views limit 54',[],null,new ClickHouseDB\WriteToFile('/tmp/_5_select.csv',true,ClickHouseDB\WriteToFile::FORMAT_CSV));
```

Stream
------

[](#stream)

streamWrite() : Closure stream write

```
$streamWrite=new ClickHouseDB\Transport\StreamWrite($stream);

$client->streamWrite(
        $streamWrite,                                   // StreamWrite Class
        'INSERT INTO {table_name} FORMAT JSONEachRow',  // SQL Query
        ['table_name'=>'_phpCh_SteamTest']              // Binds
    );
```

### streamWrite &amp; custom Closure &amp; Deflate

[](#streamwrite--custom-closure--deflate)

```
$stream = fopen('php://memory','r+');

for($f=0;$f$f]).PHP_EOL );
}

rewind($stream); // rewind stream

$streamWrite=new ClickHouseDB\Transport\StreamWrite($stream);
$streamWrite->applyGzip();   // Add Gzip zlib.deflate in stream

$callable = function ($ch, $fd, $length) use ($stream) {
    return ($line = fread($stream, $length)) ? $line : '';
};
// Apply closure
$streamWrite->closure($callable);
// Run Query
$r=$client->streamWrite($streamWrite,'INSERT INTO {table_name} FORMAT JSONEachRow', ['table_name'=>'_phpCh_SteamTest']);
// Result
print_r($r->info_upload());
```

### streamRead

[](#streamread)

streamRead is like `WriteToFile`

```
$stream = fopen('php://memory','r+');
$streamRead=new ClickHouseDB\Transport\StreamRead($stream);

$r=$client->streamRead($streamRead,'SELECT sin(number) as sin,cos(number) as cos FROM {table_name} LIMIT 4 FORMAT JSONEachRow', ['table_name'=>'system.numbers']);
rewind($stream);
while (($buffer = fgets($stream, 4096)) !== false) {
    echo ">>> ".$buffer;
}
fclose($stream); // Need Close Stream

// Send to closure

$stream = fopen('php://memory','r+');
$streamRead=new ClickHouseDB\Transport\StreamRead($stream);
$callable = function ($ch, $string) use ($stream) {
    // some magic for _BLOCK_ data
    fwrite($stream, str_ireplace('"sin"','"max"',$string));
    return strlen($string);
};

$streamRead->closure($callable);

$r=$client->streamRead($streamRead,'SELECT sin(number) as sin,cos(number) as cos FROM {table_name} LIMIT 44 FORMAT JSONEachRow', ['table_name'=>'system.numbers']);
```

### insert Assoc Bulk

[](#insert-assoc-bulk)

```
 $oneRow = [
            'one' => 1,
            'two' => 2,
            'thr' => 3,
            ];
            $failRow = [
                'two' => 2,
                'one' => 1,
                'thr' => 3,
            ];

$db->insertAssocBulk([$oneRow, $oneRow, $failRow])
```

### progressFunction

[](#progressfunction)

```
// Apply function

$db->progressFunction(function ($data) {
    echo "CALL FUNCTION:".json_encode($data)."\n";
});
$st=$db->select('SELECT number,sleep(0.2) FROM system.numbers limit 5');

// Print
// ...
// CALL FUNCTION:{"read_rows":"2","read_bytes":"16","total_rows":"0"}
// CALL FUNCTION:{"read_rows":"3","read_bytes":"24","total_rows":"0"}
// ...
```

### Cluster

[](#cluster)

```
$config = [
    'host' => 'cluster.clickhouse.dns.com', // any node name in cluster
    'port' => '8123',
    'username' => 'default', // all node have one login+password
    'password' => ''
];

// client connect first node, by DNS, read list IP, then connect to ALL nodes for check is !OK!

$cl = new ClickHouseDB\Cluster($config);
$cl->setScanTimeOut(2.5); // 2500 ms, max time connect per one node

// Check replica state is OK
if (!$cl->isReplicasIsOk())
{
    throw new Exception('Replica state is bad , error='.$cl->getError());
}

// get array nodes, and clusers
print_r($cl->getNodes());
print_r($cl->getClusterList());

// get node by cluster
$name='some_cluster_name';
print_r($cl->getClusterNodes($name));

// get counts
echo "> Count Shard   = ".$cl->getClusterCountShard($name)."\n";
echo "> Count Replica = ".$cl->getClusterCountReplica($name)."\n";

// get nodes by table & print size per node
$nodes=$cl->getNodesByTable('shara.adpreview_body_views_sharded');
foreach ($nodes as $node)
{
    echo "$node > \n";
    // select one node
    print_r($cl->client($node)->tableSize('adpreview_body_views_sharded'));
    print_r($cl->client($node)->showCreateTable('shara.adpreview_body_views'));
}

// work with one node

// select by IP like "*.248*" = `123.123.123.248`, dilitmer `;`  , if not fount -- select first node
$cli=$cl->clientLike($name,'.298;.964'); // first find .298 then .964 , result is ClickHouseDB\Client

$cli->ping();

// truncate table on cluster
$result=$cl->truncateTable('dbNane.TableName_sharded');

// get one active node ( random )
$cl->activeClient()->setTimeout(0.01);
$cl->activeClient()->write("DROP TABLE IF EXISTS default.asdasdasd ON CLUSTER cluster2");

// find `is_leader` node
$cl->getMasterNodeForTable('dbNane.TableName_sharded');

// errors
var_dump($cl->getError());

//
```

### Return Extremes

[](#return-extremes)

```
$db->enableExtremes(true);
```

### Enable Log Query

[](#enable-log-query)

You can log all query in ClickHouse

```
$db->enableLogQueries();
$db->select('SELECT 1 as p');
print_r($db->select('SELECT * FROM system.query_log')->rows());
```

### isExists

[](#isexists)

```
$db->isExists($database,$table);
```

### Debug &amp; Verbose

[](#debug--verbose)

```
$db->verbose();
```

### Dev &amp; PHPUnit Test

[](#dev--phpunit-test)

- Don't forget to run composer install. It should setup PSR-4 autoloading.
- Then you can simply run vendor/bin/phpunit and it should output the following

```
cp phpunit.xml.dist phpunit.xml
mcedit phpunit.xml
```

Edit in phpunit.xml constants:

```

```

Run docker ClickHouse server

```
cd ./tests
docker-compose up

```

Run test

```
./vendor/bin/phpunit

./vendor/bin/phpunit --group ClientTest

./vendor/bin/phpunit --group ConditionsTest

```

Run PHPStan

```
# Main
./vendor/bin/phpstan analyse src tests --level 7
# SRC only
./vendor/bin/phpstan analyse src --level 7

# Examples
./vendor/bin/phpstan analyse example -a ./example/Helper.php

```

License
-------

[](#license)

MIT

ChangeLog
---------

[](#changelog)

See [changeLog.md](CHANGELOG.md)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 82% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~113 days

Recently: every ~342 days

Total

17

Last Release

984d ago

PHP version history (2 changes)1.2.4PHP &gt;=7.0

1.3.1PHP ^7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25237042?v=4)[glutwins](/maintainers/glutwins)[@glutwins](https://github.com/glutwins)

---

Top Contributors

[![isublimity](https://avatars.githubusercontent.com/u/1861412?v=4)](https://github.com/isublimity "isublimity (410 commits)")[![simPod](https://avatars.githubusercontent.com/u/327717?v=4)](https://github.com/simPod "simPod (28 commits)")[![dorantor](https://avatars.githubusercontent.com/u/391611?v=4)](https://github.com/dorantor "dorantor (12 commits)")[![glutwins](https://avatars.githubusercontent.com/u/25237042?v=4)](https://github.com/glutwins "glutwins (10 commits)")[![dmitriy-gladkih](https://avatars.githubusercontent.com/u/6246868?v=4)](https://github.com/dmitriy-gladkih "dmitriy-gladkih (9 commits)")[![argayash](https://avatars.githubusercontent.com/u/790535?v=4)](https://github.com/argayash "argayash (7 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (4 commits)")[![andsm](https://avatars.githubusercontent.com/u/2169786?v=4)](https://github.com/andsm "andsm (3 commits)")[![sublimity-zz](https://avatars.githubusercontent.com/u/1270880?v=4)](https://github.com/sublimity-zz "sublimity-zz (2 commits)")[![moknomo](https://avatars.githubusercontent.com/u/2641095?v=4)](https://github.com/moknomo "moknomo (1 commits)")[![Phrlog](https://avatars.githubusercontent.com/u/9060150?v=4)](https://github.com/Phrlog "Phrlog (1 commits)")[![SerafimArts](https://avatars.githubusercontent.com/u/2461257?v=4)](https://github.com/SerafimArts "SerafimArts (1 commits)")[![serghacker](https://avatars.githubusercontent.com/u/7020844?v=4)](https://github.com/serghacker "serghacker (1 commits)")[![shepik](https://avatars.githubusercontent.com/u/203454?v=4)](https://github.com/shepik "shepik (1 commits)")[![tabuna](https://avatars.githubusercontent.com/u/5102591?v=4)](https://github.com/tabuna "tabuna (1 commits)")[![toxbyte](https://avatars.githubusercontent.com/u/15818073?v=4)](https://github.com/toxbyte "toxbyte (1 commits)")[![FallDi](https://avatars.githubusercontent.com/u/4299295?v=4)](https://github.com/FallDi "FallDi (1 commits)")[![greevex](https://avatars.githubusercontent.com/u/148401?v=4)](https://github.com/greevex "greevex (1 commits)")[![Har01d](https://avatars.githubusercontent.com/u/14060856?v=4)](https://github.com/Har01d "Har01d (1 commits)")[![iShift](https://avatars.githubusercontent.com/u/426427?v=4)](https://github.com/iShift "iShift (1 commits)")

---

Tags

httpphpclientcurlhttp clientdriverclickhouse

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/glutwins-phpclickhouse/health.svg)

```
[![Health](https://phpackages.com/badges/glutwins-phpclickhouse/health.svg)](https://phpackages.com/packages/glutwins-phpclickhouse)
```

###  Alternatives

[smi2/phpclickhouse

PHP ClickHouse Client

83510.1M71](/packages/smi2-phpclickhouse)[simpod/clickhouse-client

PHP ClickHouse Client

19116.7k](/packages/simpod-clickhouse-client)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.0k](/packages/ismaeltoe-osms)[popphp/pop-http

Pop Http Component for Pop PHP Framework

1018.5k13](/packages/popphp-pop-http)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
