PHP code example of fatrbaby / hellobase

1. Go to this page and download the library: Download fatrbaby/hellobase 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/ */

    

fatrbaby / hellobase example snippets


use HelloBase\Connection;

$config = [
    'host' => 'localhost',
    'port' => '9090',
    'auto_connect' => false,
    'persist' => false,
    'debug_handler' => null,
    'send_timeout' => 1000000,
    'recv_timeout' => 1000000,
    'transport' => Connection::TRANSPORT_BUFFERED,
    'protocol' => Connection::PROTOCOL_BINARY_ACCELERATED,
];

$connection = new Connection($config);
$connection->connect();

# get tables 
$connection->tables();

# get table instance
$table = $connection->table('tableName');

# put data
$table->put('row-name', ['cf:foo' => 'bar']);

# get row
$table->row('row-name', ['column1', ...]);

# get rows
$table->rows(['row-name1', 'row-name2', ...], ['column1', ...]);

# increment 
$table->increment('row-name', 'column-name', int amount)

# scan
foreach($table->scan(<startRow>, <stopRow>, <['column1', ...]>, <['condition1', ...]>) as $row => $columns) {
    // do something
}