Download the PHP package tx-admin/hyperf-clickhouse without Composer
On this page you can find all versions of the php package tx-admin/hyperf-clickhouse. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package hyperf-clickhouse
phpClickHouse-hyperf
Adapter to Hyperf framework of the most popular libraries:
- https://github.com/the-tinderbox/ClickhouseBuilder - good query builder
Features
No dependency
More: https://github.com/smi2/phpClickHouse#features
Prerequisites
- PHP 7.1
- PHP-ext swoole ^4.5.0 > 4.6.0
- Hyperf PHP
- Clickhouse server
Installation
-
Install via composer
- Add new connection into your config/database.php:
Then patch your .env:
- Used
You can use smi2/phpClickHouse functionality directly:
More about $db see here: https://github.com/smi2/phpClickHouse/blob/master/README.md
Or use dawnings of Eloquent ORM (will be implemented completely)
-
Add model
-
Add migration
- And then you can insert data
One row
Or bulk insert
Non assoc way
MyTable::insertBulk([['model 1', 1], ['model 2', 2]], ['model_name', 'some_param']);
Assoc way
MyTable::insertAssoc([['model_name' => 'model 1', 'some_param' => 1], ['some_param' => 2, 'model_name' => 'model 2']]);
- Now check out the query builder
Advanced usage
Retries You may enable ability to retry requests while received not 200 response, maybe due network connectivity problems.
Patch your .env:
CLICKHOUSE_RETRIES=2
retries is optional, default value is 0. 0 mean only one attempt. 1 mean one attempt + 1 retry while error (total 2 attempts).
Working with huge rows
You can chunk results like in Laravel
Buffer engine for insert queries See https://clickhouse.tech/docs/en/engines/table-engines/special/buffer/
If you also want to read from your buffer table, put its name in $table
OPTIMIZE Statement See https://clickhouse.com/docs/ru/sql-reference/statements/optimize/
Deletions
See https://clickhouse.com/docs/en/sql-reference/statements/alter/delete/
Using buffer engine and performing OPTIMIZE or ALTER TABLE DELETE