PHP code example of prageeth-peiris / laravel-query-builder-to-clickhouse

1. Go to this page and download the library: Download prageeth-peiris/laravel-query-builder-to-clickhouse 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/ */

    

prageeth-peiris / laravel-query-builder-to-clickhouse example snippets


// Usage description here

//Add following database connections to config/database.php 

       'bavix::clickhouse' => [
            'driver' => 'bavix::clickhouse',
            'host' => env('CLICKHOUSE_HOST'),
            'port' => env('CLICKHOUSE_PORT',8123),
            'database' => env('CLICKHOUSE_DATABASE'),
            'username' => env('CLICKHOUSE_USER','default'),
            'password' => env('CLICKHOUSE_PASSWORD'),
            'options' => [
                'timeout' => 20,
                'protocol' => 'http'
            ]
        ],
        'clickhouse_custom' => [
            'driver' => 'bavix::clickhouse::custom',
            'host' => env('CLICKHOUSE_HOST'),
            'port' => env('CLICKHOUSE_PORT',8123),
            'database' => env('CLICKHOUSE_DATABASE'),
            'username' => env('CLICKHOUSE_USER','default'),
            'password' => env('CLICKHOUSE_PASSWORD'),
            'options' => [
                'timeout' => 20,
                'protocol' => 'http'
            ]
        ]

//extend from this model and start using clickhouse
use PrageethPeiris\LaravelQueryBuilderToClickhouse\Model;

Class CustomModel extends BaseClickHouseModel {

//this is