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

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

desbiger/laravel-clickhouse
===========================

0.2(6y ago)03MITPHPPHP &gt;=7.1

Since Dec 1Pushed 6y agoCompare

[ Source](https://github.com/desbiger/laravel-clickhouse)[ Packagist](https://packagist.org/packages/desbiger/laravel-clickhouse)[ RSS](/packages/desbiger-laravel-clickhouse/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (5)Versions (7)Used By (0)

laravel-clickhouse
==================

[](#laravel-clickhouse)

[![Build Status](https://camo.githubusercontent.com/2a95037d663caf4377811a460057bfc8f804eb93efb64649fc5f869028e30d7b/68747470733a2f2f7472617669732d63692e6f72672f6573617a796b696e2f6c61726176656c2d636c69636b686f7573652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/esazykin/laravel-clickhouse)[![StyleCI](https://camo.githubusercontent.com/0e9dddda6020fecf0c7154600261cb4b0b82d8fff4efb50aebcbc4738836b249/68747470733a2f2f7374796c6563692e696f2f7265706f732f3131323735363239382f736869656c643f6272616e63683d6d6173746572)](https://styleci.io/repos/112756298)[![Coverage Status](https://camo.githubusercontent.com/4d8586cf4d5c71046dabf396186f14052d0f03c21c16e5b6c586f543dfdc0d88/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6573617a796b696e2f6c61726176656c2d636c69636b686f7573652f62616467652e737667)](https://coveralls.io/github/esazykin/laravel-clickhouse)

Eloquent model for ClickHouse

Prerequisites
-------------

[](#prerequisites)

- php 7.1
- clickhouse server

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

[](#installation)

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

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

```
Esazykin\LaravelClickHouse\ClickHouseServiceProvider::class,
```

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

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

Or like this, if clickhouse runs in cluster

```
'connections' => [
    'clickhouse' => [
        'driver' => 'clickhouse',
        'cluster' => [
            'server-1' => [
                'host' => '',
                'port' => '',
                'database' => '',
                'username' => '',
                'password' => '',
                'options' => [
                    'timeout' => 10,
                    'protocol' => 'https'
                ]
            ],
            'server-2' => [
                'host' => '',
                'port' => '',
                'database' => '',
                'username' => '',
                'password' => '',
                'options' => [
                    'timeout' => 10,
                    'protocol' => 'https'
                ]
            ]
        ]
    ]
]
```

Then create model

```
