Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpclickhouse Laravel Package

smi2/phpclickhouse

PHP client for ClickHouse with an easy, fluent API. Supports queries and inserts, result sets, bindings, and connection configuration for fast analytics workflows. Suitable for Laravel and standalone PHP apps needing reliable ClickHouse access.

View on GitHub
Deep Wiki
Context7

layout: default title: Progress Function

< Back to Home

Progress Function

Monitor query execution progress in real-time via HTTP headers.

Usage

$db->progressFunction(function ($data) {
    echo json_encode($data) . "\n";
});

Works for both SELECT and INSERT/WRITE operations.

SELECT Progress

$db->progressFunction(function ($data) {
    echo sprintf(
        "Read: %s rows, %s bytes\n",
        $data['read_rows'] ?? 0,
        $data['read_bytes'] ?? 0
    );
});

$st = $db->select('SELECT number, sleep(0.1) FROM system.numbers LIMIT 100');

// Output:
// Read: 10 rows, 80 bytes
// Read: 20 rows, 160 bytes
// Read: 30 rows, 240 bytes
// ...

INSERT/WRITE Progress

$db->progressFunction(function ($data) {
    echo sprintf(
        "Written: %s rows, %s bytes\n",
        $data['written_rows'] ?? 0,
        $data['written_bytes'] ?? 0
    );
});

// Insert a large batch
$rows = [];
for ($i = 0; $i < 100000; $i++) {
    $rows[] = [$i, "item_$i"];
}
$db->insert('my_table', $rows, ['id', 'name']);

Progress Data Format

The callback receives an associative array with these fields:

Field Description
read_rows Number of rows read so far
read_bytes Number of bytes read so far
written_rows Number of rows written (INSERT)
written_bytes Number of bytes written (INSERT)
total_rows_to_read Total rows to read (if known)

Settings

progressFunction() automatically enables:

Setting Value Purpose
send_progress_in_http_headers 1 Enable progress headers
http_headers_progress_interval_ms 100 Update interval (ms)
wait_end_of_query 1 Required for write progress

You can customize the interval before calling progressFunction():

$db->settings()->set('http_headers_progress_interval_ms', 500); // every 500ms
$db->progressFunction($callback);
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor