Skip to content

zolotov88/laravel-clickhouse

 
 

Repository files navigation

Laravel Clickhouse

Maintainability License Latest Stable Version PHP Version Require StyleCI PSALM

Requirements

  • laravel 7+
  • php 7.4+

Install

composer require churakovmike/laravel-clickhouse

If you need the latest version

composer require churakovmike/laravel-clickhouse:dev-main

Integrations

In config/app.php add:

    'providers' => [
        ...
        \ChurakovMike\LaravelClickHouse\ClickhouseServiceProvider::class,
        ...
    ]

Connection configures via config/database.php

Clickhouse default configuration example:

'connections' => [
    'clickhouse' => [
        'driver' => 'clickhouse',
        'host' => 'http://127.0.0.1',
        'port' => 8123,
        'database' => 'database_name',
        'username' => 'default',
        'password' => '',
        'options' => [
            'timeout' => 10,
        ]
    ]
]

Usage

Create new own model and inherit from the new model

<?php

namespace App;

use ChurakovMike\LaravelClickHouse\Database\Model;

class Events extends Model
{
    // ...
}

That's all, you can work with clickhouse using the familiar Eloquent model.

Following features coming soon

  • Clusters switching
  • Server switching
  • Native clickhouse functions for the model (sumIf, countIf, quantilesTimingIf, argMinIf and etc.)
  • New migration manager and new Blueprint for Clickhouse
  • New data types for queries

About

Laravel Eloquent integration with Clickhouse

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%