bavix/laravel-clickhouse 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bavix/laravel-clickhouse

最新稳定版本:3.0.5

Composer 安装命令:

composer require bavix/laravel-clickhouse

包简介

Eloquent model for ClickHouse

README 文档

README

Latest Stable Version License composer.lock

Laravel Clickhouse - Eloquent model for ClickHouse.

  • Vendor: bavix
  • Package: laravel-clickhouse
  • Composer: composer require bavix/laravel-wallet-uuid

Important

I recommend using the standard postgres/mysql interface for clickhouse. More details here: https://clickhouse.com/docs/en/interfaces/mysql

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

$ 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();

统计信息

  • 总下载量: 197.99k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 71
  • 点击次数: 1
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 68
  • Watchers: 1
  • Forks: 103
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-06-12