monikon22/laravel-clickhouse
最新稳定版本:3.0.5
Composer 安装命令:
composer require monikon22/laravel-clickhouse
包简介
Eloquent model for ClickHouse
README 文档
README
Laravel Clickhouse - Eloquent model for ClickHouse.
- Vendor: bavix
- Package: Laravel Clickhouse
- Version:
- Laravel Version:
6.x,7.x,8.x,9.x - PHP Version: 7.2+
- Composer:
composer require bavix/laravel-clickhouse
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
<?php use Bavix\LaravelClickHouse\Database\Eloquent\Model; class Payment extends Model { protected $table = 'payments'; }
And use it
Payment::select(raw('count() AS cnt'), 'payment_system') ->whereBetween('payed_at', [ Carbon\Carbon::parse('2017-01-01'), now(), ]) ->groupBy('payment_system') ->get();
Supported by
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-28