PHPackages                             bavix/laravel-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. [Database &amp; ORM](/categories/database)
4. /
5. bavix/laravel-clickhouse

ActiveLibrary[Database &amp; ORM](/categories/database)

bavix/laravel-clickhouse
========================

Eloquent model for ClickHouse

3.1.0(4mo ago)71232.8k↓41.6%402MITPHPPHP ^8.2CI failing

Since Jul 9Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/bavix/laravel-clickhouse)[ Packagist](https://packagist.org/packages/bavix/laravel-clickhouse)[ RSS](/packages/bavix-laravel-clickhouse/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (30)Versions (24)Used By (2)

Laravel Clickhouse
==================

[](#laravel-clickhouse)

[![Latest Stable Version](https://camo.githubusercontent.com/13c01a1bd825e0ae9af64318228f80716b9c8a1cbd55570d96e8fce1b181b598/68747470733a2f2f706f7365722e707567782e6f72672f62617669782f6c61726176656c2d636c69636b686f7573652f762f737461626c65)](https://packagist.org/packages/bavix/laravel-clickhouse)[![License](https://camo.githubusercontent.com/12ff77b2ad8825f6923ea55c64c690032649bc24882665a59a49529f23a203ae/68747470733a2f2f706f7365722e707567782e6f72672f62617669782f6c61726176656c2d636c69636b686f7573652f6c6963656e7365)](https://packagist.org/packages/bavix/laravel-clickhouse)[![composer.lock](https://camo.githubusercontent.com/71f9f26dc80941ed4743e1827dfc6f014d38585e720ed7d91316a909cffc43f5/68747470733a2f2f706f7365722e707567782e6f72672f62617669782f6c61726176656c2d636c69636b686f7573652f636f6d706f7365726c6f636b)](https://packagist.org/packages/bavix/laravel-clickhouse)

Warning

**This project is provided "As Is".**
The maintainers are not actively developing new features or fixing bugs.
**Pull Requests are welcome!** If you need a fix or feature, please submit a PR with tests.

Laravel Clickhouse - Eloquent model for ClickHouse.

- **Vendor**: bavix
- **Package**: laravel-clickhouse
- **[Composer](https://getcomposer.org/):** `composer require bavix/laravel-clickhouse`

Important

I recommend using the standard postgres/mysql interface for clickhouse. More details here:

The implementation is provided as is. Further work with the library only through contributors. Added linters, tests and much more. To make it easier for you to send PR.

Get started
-----------

[](#get-started)

```
$ composer require bavix/laravel-clickhouse
```

Then add the code above into your config/app.php file providers section

```
Bavix\LaravelClickHouse\ClickHouseServiceProvider::class,
```

And add new connection into your config/database.php file. Something like this:

```
'connections' => [
    'bavix::clickhouse' => [
        'driver' => 'bavix::clickhouse',
        'host' => '',
        'port' => '',
        'database' => '',
        'username' => '',
        'password' => '',
        'options' => [
            'timeout' => 10,
            'protocol' => 'https'
        ]
    ]
]
```

Or like this, if clickhouse runs in cluster

```
'connections' => [
    'bavix::clickhouse' => [
        'driver' => 'bavix::clickhouse',
        'servers' => [
            [
                'host' => 'ch-00.domain.com',
                'port' => '',
                'database' => '',
                'username' => '',
                'password' => '',
                'options' => [
                    'timeout' => 10,
                    'protocol' => 'https'
                ]
            ],
            [
                'host' => 'ch-01.domain.com',
                'port' => '',
                'database' => '',
                'username' => '',
                'password' => '',
                'options' => [
                    'timeout' => 10,
                    'protocol' => 'https'
                ]
            ]
        ]
    ]
],
```

Then create model

```
