Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/esazykin/laravel-clickhouse
Eloquent model for ClickHouse
https://github.com/esazykin/laravel-clickhouse
Last synced: about 2 months ago
JSON representation
Eloquent model for ClickHouse
- Host: GitHub
- URL: https://github.com/esazykin/laravel-clickhouse
- Owner: esazykin
- Created: 2017-12-01T15:38:22.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-01T19:04:34.000Z (8 months ago)
- Last Synced: 2024-09-18T02:29:16.530Z (3 months ago)
- Language: PHP
- Size: 61.5 KB
- Stars: 53
- Watchers: 5
- Forks: 92
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-clickhouse - esazykin/laravel-clickhouse - This project provides an Eloquent model for integrating ClickHouse with Laravel applications. (Language bindings / PHP)
README
# laravel-clickhouse
[![Build Status](https://travis-ci.org/esazykin/laravel-clickhouse.svg?branch=master)](https://travis-ci.org/esazykin/laravel-clickhouse)
[![StyleCI](https://styleci.io/repos/112756298/shield?branch=master)](https://styleci.io/repos/112756298)
[![Coverage Status](https://coveralls.io/repos/github/esazykin/laravel-clickhouse/badge.svg)](https://coveralls.io/github/esazykin/laravel-clickhouse)Eloquent model for ClickHouse
## Prerequisites
- php 7.1
- clickhouse server## Installation
```sh
$ composer require esazykin/laravel-clickhouse
```Then add the code above into your config/app.php file providers section
```php
Esazykin\LaravelClickHouse\ClickHouseServiceProvider::class,
```
And add new connection into your config/database.php file. Something like this:
```php
'connections' => [
'clickhouse' => [
'driver' => 'clickhouse',
'host' => '',
'port' => '',
'database' => '',
'username' => '',
'password' => '',
'options' => [
'timeout' => 10,
'protocol' => 'https'
]
]
]
```
Or like this, if clickhouse runs in cluster
```php
'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
```php
whereBetween('payed_at', [
Carbon\Carbon::parse('2017-01-01'),
now(),
])
->groupBy('payment_system')
->get();```
## Roadmap
- more tests
- Model::with() method
- relations