PHPackages                             joaojkuligowski/laravel-fluent-clickhouse-driver - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. joaojkuligowski/laravel-fluent-clickhouse-driver

ActiveLibrary[Database &amp; ORM](/categories/database)

joaojkuligowski/laravel-fluent-clickhouse-driver
================================================

Fluent Eloquent for ClickHouse

010PHP

Since Aug 7Pushed 9mo agoCompare

[ Source](https://github.com/joaojkuligowski/laravel-fluent-clickhouse-driver)[ Packagist](https://packagist.org/packages/joaojkuligowski/laravel-fluent-clickhouse-driver)[ RSS](/packages/joaojkuligowski-laravel-fluent-clickhouse-driver/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel ClickHouse Eloquent Driver
==================================

[](#laravel-clickhouse-eloquent-driver)

Package proudly made in Brazil &lt;3! [English](https://github.com/joaojkuligowski/laravel-fluent-clickhouse-driver/blob/main/README.md) | [Portuguese](https://github.com/joaojkuligowski/laravel-fluent-clickhouse-driver/blob/main/README-pt-BR.md)

[![Latest Version on Packagist](https://camo.githubusercontent.com/77be91ec95ccc1547b9c9e8da1034b46d0af6cd8537c17bab1e5a2c418fe67ac/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6f616f6a6b756c69676f77736b692f6c61726176656c2d666c75656e742d636c69636b686f7573652d6472697665722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/joaojkuligowski/laravel-fluent-clickhouse-driver)[![Total Downloads](https://camo.githubusercontent.com/6127188c89e778b6c2ebada9e136c539d50cd5423fd4bf6f9afba96af33d833f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6f616f6a6b756c69676f77736b692f6c61726176656c2d666c75656e742d636c69636b686f7573652d6472697665722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/joaojkuligowski/laravel-fluent-clickhouse-driver)

A fluent Eloquent driver for ClickHouse database integration with Laravel. This package allows you to use Laravel's Eloquent ORM with ClickHouse databases, providing a familiar and powerful interface for analytics and big data operations.

Features
--------

[](#features)

- 🚀 Full Laravel Eloquent ORM compatibility
- 🔧 Fluent query builder support
- 📊 Optimized for ClickHouse analytics operations
- 🌐 HTTP and TCP connection modes
- 🔒 Secure authentication support
- ⚡ Asynchronous query support
- 🧪 Comprehensive testing suite

Requirements
------------

[](#requirements)

- PHP ^8.2
- Laravel ^12.0
- ClickHouse Server

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require joaojkuligowski/laravel-fluent-clickhouse-driver
```

The package will automatically register its service providers through Laravel's auto-discovery feature.

Configuration
-------------

[](#configuration)

### Database Configuration

[](#database-configuration)

Add a ClickHouse connection to your `config/database.php` file:

```
'connections' => [
    // ... your other database connections

    'clickhouse' => [
        'driver' => 'clickhouse',
        'host' => env('CLICKHOUSE_HOST', '127.0.0.1'),
        'port' => env('CLICKHOUSE_PORT', 8123),
        'database' => env('CLICKHOUSE_DATABASE', 'default'),
        'username' => env('CLICKHOUSE_USERNAME', 'default'),
        'password' => env('CLICKHOUSE_PASSWORD', ''),
        'https' => env('CLICKHOUSE_HTTPS', false),
        'mode' => env('CLICKHOUSE_MODE', 'tcp'), // 'tcp' or 'http'
        'readonly' => env('CLICKHOUSE_READONLY', false),
        'async' => env('CLICKHOUSE_ASYNC', false),
    ],
],
```

### Environment Variables

[](#environment-variables)

Add these variables to your `.env` file:

```
CLICKHOUSE_HOST=127.0.0.1
CLICKHOUSE_PORT=8123
CLICKHOUSE_DATABASE=default
CLICKHOUSE_USERNAME=default
CLICKHOUSE_PASSWORD=
CLICKHOUSE_HTTPS=false
CLICKHOUSE_MODE=tcp
CLICKHOUSE_READONLY=false
CLICKHOUSE_ASYNC=false
```

Usage
-----

[](#usage)

### Creating Models

[](#creating-models)

Create ClickHouse models by extending the `LaravelClickhouseModel`:

```
