PHPackages                             ddkirawan/clickhouse - 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. ddkirawan/clickhouse

ActiveYii2-extension

ddkirawan/clickhouse
====================

Driver yii2 for column-oriented database ClickHouse.

00

Since Sep 17Pushed 2y agoCompare

[ Source](https://github.com/ddkirawan/clickhouse)[ Packagist](https://packagist.org/packages/ddkirawan/clickhouse)[ RSS](/packages/ddkirawan-clickhouse/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Extension ClickHouse for Yii 2
==============================

[](#extension-clickhouse-for-yii-2)

This extension provides the [ClickHouse](https://clickhouse.yandex/) integration for the [Yii framework 2.0](http://www.yiiframework.com). Main features:

- SQL commands
- Query builder
- Schema builder
- Migrations
- Batch Insert
- Parallel insert from large CSV files
- Valid handling of UInt64 type in PHP
- Supports Decimals and Nullable fields

[![Build Status](https://camo.githubusercontent.com/9d39d08cc9f1dba028313e40fd8641142e7358a36197c2047878a82cd9399833/68747470733a2f2f7472617669732d63692e6f72672f626173686b617265762f636c69636b686f7573652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bashkarev/clickhouse)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require bashkarev/clickhouse

```

Configuration
-------------

[](#configuration)

To use this extension, simply add the following code in your application configuration:

```
return [
    //....
    'clickhouse' => [
        'class' => 'bashkarev\clickhouse\Connection',
        'dsn' => 'host=localhost;port=8123;database=default;connect_timeout_with_failover_ms=10',
        'username' => 'default',
        'password' => '',
    ],
];
```

[All settings](https://clickhouse.yandex/docs/en/operations/settings/index.html)

Using DebugPanel
----------------

[](#using-debugpanel)

Add the following to you application config to enable it (if you already have the debug module enabled, it is sufficient to just add the panels configuration):

```
    // ...
    'bootstrap' => ['debug'],
    'modules' => [
        'debug' => [
            'class' => 'yii\\debug\\Module',
            'panels' => [
                'clickhouse' => [
                    'class' => 'bashkarev\clickhouse\debug\Panel',
                    // 'db' => 'clickhouse', // ClickHouse component ID, defaults to `db`. Uncomment and change this line, if you registered component with a different ID.
                ],
            ],
        ],
    ],
    // ...
```

Using Migrations
----------------

[](#using-migrations)

In order to enable this command you should adjust the configuration of your console application:

```
return [
    // ...
    'controllerMap' => [
        'clickhouse-migrate' => 'bashkarev\clickhouse\console\controllers\MigrateController'
    ],
];
```

```
# creates a new migration named 'create_target'
yii clickhouse-migrate/create create_target

# applies ALL new migrations
yii clickhouse-migrate

# reverts the last applied migration
yii clickhouse-migrate/down
```

Access to native SMI2 ClickHouse client
---------------------------------------

[](#access-to-native-smi2-clickhouse-client)

```
$client = \Yii::$app->clickhouse->getClient();
```

Insert csv files
----------------

[](#insert-csv-files)

> Files are uploaded in parallel.

```
$db = \Yii::$app->clickhouse;
$client = $db->getClient();

$results = $client->insertBatchFiles('table_name', ['file_with_data.csv']);

$state = $results['file_with_data.csv'];
$isSuccess = !$state->isError();
$uploadInfo = $state->responseInfo();

print_r($uploadInfo);
```

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 63.9% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/837ab6952fa258b234a9f0efac211cde1f88220ee408845548694269e57d61db?d=identicon)[ddkirawan](/maintainers/ddkirawan)

---

Top Contributors

[![bashkarev](https://avatars.githubusercontent.com/u/3738201?v=4)](https://github.com/bashkarev "bashkarev (39 commits)")[![sartor](https://avatars.githubusercontent.com/u/159053?v=4)](https://github.com/sartor "sartor (14 commits)")[![zkelo](https://avatars.githubusercontent.com/u/13527447?v=4)](https://github.com/zkelo "zkelo (4 commits)")[![tyron098](https://avatars.githubusercontent.com/u/45968707?v=4)](https://github.com/tyron098 "tyron098 (1 commits)")[![MysteryDragon](https://avatars.githubusercontent.com/u/3968363?v=4)](https://github.com/MysteryDragon "MysteryDragon (1 commits)")[![fgh151](https://avatars.githubusercontent.com/u/645524?v=4)](https://github.com/fgh151 "fgh151 (1 commits)")[![arkhamvm](https://avatars.githubusercontent.com/u/9816112?v=4)](https://github.com/arkhamvm "arkhamvm (1 commits)")

### Embed Badge

![Health badge](/badges/ddkirawan-clickhouse/health.svg)

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

PHPackages © 2026

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