PHP code example of rapiddive / nrql-builder
1. Go to this page and download the library: Download rapiddive/nrql-builder 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/ */
rapiddive / nrql-builder example snippets
use Carbon\Carbon;
use Rapiddive\NrqlBuilder\Moment\ExactTime;
use Rapiddive\NrqlBuilder\Moment\TimeAgo;
use Rapiddive\NrqlBuilder\Moment\Yesterday;
use Rapiddive\NrqlBuilder\QueryBuilder;
use Rapiddive\NrqlBuilder\TimePeriod;
$nrql = new QueryBuilder();
$nrql->select([
'userAgentName',
])
->from([
'PageView',
])
->where('userAgentOS = "Windows"')
->facet('countryCode')
->limit(20)
->since(new TimeAgo(new TimePeriod(4, TimePeriod::UNIT_DAYS)))
->until(new Yesterday())
->compareWith(new ExactTime(new Carbon('2015-01-01 00:00:00')))
->timeSeries(new TimePeriod(1, TimePeriod::UNIT_HOURS));
echo $nrql;