PHPackages                             ssalpo/laravel-clickhouse - 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. ssalpo/laravel-clickhouse

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

ssalpo/laravel-clickhouse
=========================

ClickHouse migrations for Laravel

1.0.0(2y ago)016MITPHPPHP ^8.0

Since Nov 16Pushed 2y agoCompare

[ Source](https://github.com/ssalpo/laravel-clickhouse)[ Packagist](https://packagist.org/packages/ssalpo/laravel-clickhouse)[ Docs](https://komarev.com/sources/laravel-clickhouse)[ RSS](/packages/ssalpo-laravel-clickhouse/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (2)Used By (0)

Laravel ClickHouse
==================

[](#laravel-clickhouse)

[![laravel-clickhouse](https://user-images.githubusercontent.com/1849174/158847081-af69213c-7f66-40e8-be0b-f127f128c653.png)](https://user-images.githubusercontent.com/1849174/158847081-af69213c-7f66-40e8-be0b-f127f128c653.png)

[![Discord](https://camo.githubusercontent.com/86e83e2f2ffe2f5caffed9d8886bb512bf42bf927dd8bb8e864d9e9983313ff7/68747470733a2f2f696d672e736869656c64732e696f2f7374617469632f76313f6c6f676f3d646973636f7264266c6162656c3d266d6573736167653d446973636f726426636f6c6f723d333633393366267374796c653d666c61742d737175617265)](https://discord.gg/YcZDjNTzSa)[![Releases](https://camo.githubusercontent.com/56e9ce4f3be51766b179c32093124b194fbce2962b37c6fdaf96af197f45e897/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f6379626572636f672f6c61726176656c2d636c69636b686f7573652e7376673f7374796c653d666c61742d737175617265)](https://github.com/cybercog/laravel-clickhouse/releases)[![License](https://camo.githubusercontent.com/5e89d7b7fcb146450df0c492d66bafaaea0ca2696ce2d82a93f3f2bdd29d5caf/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6379626572636f672f6c61726176656c2d636c69636b686f7573652e7376673f7374796c653d666c61742d737175617265)](https://github.com/cybercog/laravel-clickhouse/blob/master/LICENSE)

Introduction
------------

[](#introduction)

Laravel ClickHouse database integration. This package includes generation and execution of the ClickHouse database migrations in the Laravel application.

Features
--------

[](#features)

- [smi2/phpClickHouse](https://github.com/smi2/phpClickHouse#start) client integration
- Migration creation
- Migration execution

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

[](#installation)

Pull in the package through [Composer](https://getcomposer.org/).

```
composer require cybercog/laravel-clickhouse
```

Setup
-----

[](#setup)

Add environment variables in `.env` file.

```
CLICKHOUSE_HOST=localhost
CLICKHOUSE_PORT=8123
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=
CLICKHOUSE_DATABASE=default
```

### Configuration customization

[](#configuration-customization)

Publish ClickHouse configuration.

```
php artisan vendor:publish --provider="Cog\Laravel\Clickhouse\ClickhouseServiceProvider" --tag=config
```

Edit `config/clickhouse.php` file.

Usage
-----

[](#usage)

### ClickHouse client

[](#clickhouse-client)

You can use a singleton object [smi2/phpClickHouse](https://github.com/smi2/phpClickHouse#start) to query ClickHouse:

```
app(\ClickHouseDB\Client::class)->select(
    /* Query */
);

app(\ClickHouseDB\Client::class)->write(
    /* Query */
);
```

### ClickHouse database migration

[](#clickhouse-database-migration)

#### Create migration

[](#create-migration)

```
php artisan make:clickhouse-migration create_example_table
```

> New migration will be created in `database/clickhouse-migrations` directory.

#### Run migrations

[](#run-migrations)

```
php artisan clickhouse:migrate
```

To remove the interactive question during production migrations, you can use `--force` option.

```
php artisan clickhouse:migrate --force
```

##### Step

[](#step)

You can specify how many files need to be applied:

```
php artisan clickhouse:migrate --step=1
```

> Value `0` is default — all files

#### Rollback migrations

[](#rollback-migrations)

> Rolling back migrations is intentionally unavailable. Migrations should go only forward.

Changelog
---------

[](#changelog)

Detailed changes for each release are documented in the [CHANGELOG.md](https://github.com/cybercog/laravel-clickhouse/blob/master/CHANGELOG.md).

License
-------

[](#license)

- `Laravel ClickHouse` package is open-sourced software licensed under the [MIT license](LICENSE) by [Anton Komarev](https://komarev.com).

🌟 Stargazers over time
----------------------

[](#-stargazers-over-time)

[![Stargazers over time](https://camo.githubusercontent.com/e218fcfa526059e1754c8c52f65188aed1eced81e166be53c0c3f8bc5290a518/68747470733a2f2f63686172742e79687970652e6d652f6769746875622f7265706f7369746f72792d737461722f76312f525f6b67444f4841386d62512e737667)](https://yhype.me?utm_source=github&utm_medium=cybercog-laravel-clickhouse&utm_content=chart-repository-star-cumulative)

About CyberCog
--------------

[](#about-cybercog)

[CyberCog](https://cybercog.su) is a Social Unity of enthusiasts. Research the best solutions in product &amp; software development is our passion.

- [Follow us on Twitter](https://twitter.com/cybercog)

[![CyberCog](https://cloud.githubusercontent.com/assets/1849174/18418932/e9edb390-7860-11e6-8a43-aa3fad524664.png)](https://cybercog.su)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

909d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b27ebb4ab05724ae48744c141cd959784868b2a743c381b55531d1ff90ece412?d=identicon)[ssalpo](/maintainers/ssalpo)

---

Top Contributors

[![antonkomarev](https://avatars.githubusercontent.com/u/1849174?v=4)](https://github.com/antonkomarev "antonkomarev (13 commits)")[![ssalpo](https://avatars.githubusercontent.com/u/15888790?v=4)](https://github.com/ssalpo "ssalpo (3 commits)")

---

Tags

laravelmigrationdatabasedbclickhousecogcybercog

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ssalpo-laravel-clickhouse/health.svg)

```
[![Health](https://phpackages.com/badges/ssalpo-laravel-clickhouse/health.svg)](https://phpackages.com/packages/ssalpo-laravel-clickhouse)
```

###  Alternatives

[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
