PHP code example of tangwei / doris
1. Go to this page and download the library: Download tangwei/doris 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/ */
tangwei / doris example snippets
$feHost = 'http://127.0.0.1:8030';
$db = 'test_db';
$user = 'root';
$password = '';
$streamLoad = new StreamLoad($feHost, $db, $db,$password);
$builder = $streamLoad->table('test_stream_load');
$builder->data([
['user_id' => 1, 'name' => 'q', 'age' => 11],
['user_id' => 2, 'name' => 'w', 'age' => 118],
]);
$builder->data(
['user_id' => 3, 'name' => 'q3', 'age' => 9],
);
$data = $builder->load();
$streamLoad = Doris::streamLoad();
$streamLoad = Doris::streamLoad();
$builder = $streamLoad->constMemory(true)->table('test_stream_load');
$builder = Doris::table('test_stream_load');
$builder->setHeader(\Doris\StreamLoad\Header::COLUMNS, 'user_id,name,age');
$builder = Doris::table('test_stream_load');
$builder->setHeader(\Doris\StreamLoad\Header::GROUP_COMMIT, 'async_mode');
$builder = Doris::table('test_stream_load')
->setHeaders([
'format' => 'csv',
'column_separator' => ',',
'trim_double_quotes' => 'true',
'enclose' => '"',
])
->load('/user/test.csv');