churakovmike / laravel-clickhouse
Eloquent extension with Clickhouse
v0.4
2021-10-10 14:34 UTC
Requires
- php: ^7.4|^8.0
- guzzlehttp/guzzle: *
- illuminate/database: ^6.0|^7.0|^8.0
- illuminate/support: ^6.0|^7.0|^8.0
Requires (Dev)
- vimeo/psalm: 4.x-dev
README
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