Active Query Builder Web API

Client for PHP

Download the client for PHP


You can download the ready-to-use client for PHP using the "Download now" link below or install the package from the public repository. Using the package will let you keep the client up-to-date. Full source code is available at GitHub.

Direct Download

Download Active Query Builder Web API Client for PHP:

Download now

Install using Composer

Use Composer package manager to add Active Query Builder Web API Client to your PHP project:

composer require activedbsoft/webapi-active-query-builder
Composer package

Source code on GitHub

Download and review source code of Active Query Builder Web API Client for PHP on GitHub

Source on Github
Getting started with the client for PHP
Create a new API provider
$api = new ActiveQueryBuilderApi();
Create a new Transform object
$transform = new Transform();
$transform->setGuid("9dbd355e-360e-430e-9cca-df6dd8b6d8d1"); //Metadata Guid from dashboard
$transform->setSql("Select id, name from Person"); //Initial sql query
Add totals calculation
$max = new Totals();
$max->setField('id');
$max->setAggregate('Max');

$min = new Totals();
$min->setField('id');
$min->setAggregate('Min');

$transform->setTotals(array($max, $min));
Define pagination
$page = new Pagination();
$page->setSkip(2);
$page->setTake(3);
        
$transform->setPagination($page);
Setup sorting
$asc = new Sorting();
$asc->setField('id');
$asc->setOrder('Asc');

$desc = new Sorting();
$desc->setField('name');
$desc->setOrder('Desc');

$this->transform->setSortings(array($asc, $desc));
Apply filters
$filter = new ConditionGroup();

$condition = new Condition();
$condition->setField('id');
$condition->setConditionOperator('Between');
$condition->setValues(array(1, 5));

$filter->setConditions(array($condition));
		
$transform->setFilter($filter);
Hide some columns
$order = new HiddenColumn();
$order->setField('id');
		
$transform->setHiddenColumns(array($order));
Send request to the API
$result = $api->transformSqlPost($transform);
$transformedSql = $result->getSql();
Get list of query columns
$query = new SqlQuery();
$query->setGuid("9dbd355e-360e-430e-9cca-df6dd8b6d8d1"); //Metadata Guid from dashboard
$query->setText("Select id, name from Person"); //Initial sql query

$columns = $api->getQueryColumnsPost($query);