1. Go to this page and download the library: Download krak/aql 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/ */
krak / aql example snippets
use Krak\AQL;
$engine = AQL\Engine::createWithDomain([
'orders' => ['status', 'created_at']
]);
$query = 'orders.created_at < date(now()) and orders.status = "cancelled"';
try {
$processed_query = $engine->process($query);
} catch (AQL\AQLException $e) {
// any errors regarding data syntax or semantics will be caught here.
}
use Krak\AQL;
$engine = AQL\Engine::createSortWithDomain([
'categories' => ['sort', 'created_at']
]);
$query = 'categories.sort DESC, categories.created_at'; // defaults to ASCENDING.
try {
$processed_query = $engine->process($query);
} catch (AQL\AQLException $e) {
// any errors regarding data syntax or semantics will be caught here.
}