PHP code example of rasuvaeff / yii3-clickhouse-toolkit
1. Go to this page and download the library: Download rasuvaeff/yii3-clickhouse-toolkit library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rasuvaeff / yii3-clickhouse-toolkit example snippets
use SimPod\ClickHouseClient\Client\ClickHouseClient;
final readonly class ReportService
{
public function __construct(private ClickHouseClient $client) {}
public function activeUsers(): int
{
return (int) $this->client->select('SELECT count() FROM events')->getRows()[0]['count()'];
}
}
// config/common/di.php
use Psr\Http\Client\ClientInterface;
use GuzzleHttp\Client;
return [
ClientInterface::class => static fn (): Client => new Client(['timeout' => 5.0]),
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.