| Package Data | |
|---|---|
| Maintainer Username: | antonkomarev | 
| Maintainer Contact: | anton@komarev.com (Anton Komarev) | 
| Package Create Date: | 2022-03-16 | 
| Package Last Update: | 2025-10-23 | 
| Home Page: | https://komarev.com/sources/laravel-clickhouse | 
| Language: | PHP | 
| License: | MIT | 
| Last Refreshed: | 2025-11-01 15:00:02 | 
| Package Statistics | |
|---|---|
| Total Downloads: | 87,402 | 
| Monthly Downloads: | 10,257 | 
| Daily Downloads: | 239 | 
| Total Stars: | 129 | 
| Total Watchers: | 1 | 
| Total Forks: | 16 | 
| Total Open Issues: | 8 | 

Laravel ClickHouse database integration. This package includes generation and execution of the ClickHouse database migrations in the Laravel application.
Pull in the package through Composer.
composer require cybercog/laravel-clickhouse
Add environment variables in .env file.
CLICKHOUSE_HOST=localhost
CLICKHOUSE_PORT=8123
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=
CLICKHOUSE_DATABASE=default
Publish ClickHouse configuration.
php artisan vendor:publish --provider="Cog\Laravel\Clickhouse\ClickhouseServiceProvider" --tag=config
Edit config/clickhouse.php file.
You can use a singleton object smi2/phpClickHouse to query ClickHouse:
app(\ClickHouseDB\Client::class)->select(
    /* Query */
);
app(\ClickHouseDB\Client::class)->write(
    /* Query */
);
php artisan make:clickhouse-migration create_example_table
New migration will be created in
database/clickhouse-migrationsdirectory.
php artisan clickhouse:migrate
To remove the interactive question during production migrations, you can use --force option.
php artisan clickhouse:migrate --force
You can specify how many files need to be applied:
php artisan clickhouse:migrate --step=1
Value
0is default — all files
Rolling back migrations is intentionally unavailable. Migrations should go only forward.
Detailed changes for each release are documented in the CHANGELOG.md.
Laravel ClickHouse package is open-sourced software licensed under the MIT license by Anton Komarev.CyberCog is a Social Unity of enthusiasts. Research the best solutions in product & software development is our passion.