PHP code example of reportkit / laravel

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

    

reportkit / laravel example snippets


use ReportKit\Core\Source\MergedRowSource;
use ReportKit\Laravel\Source\ConnectionRowSource;

$domain = function ($query, array $filters) {
    return $query->from('orders')
        ->whereBetween('created_at', [$filters['start_date'], $filters['end_date']]);
};

$live    = new ConnectionRowSource('mysql', $domain, null, 'live');
$archive = new ConnectionRowSource('mysql_archive', $domain, null, 'archive');

$source = (new MergedRowSource([$live, $archive]))
    ->dedupeBy('id')                 // first source wins (live over archive)
    ->orderBy('created_at', 'desc');

$rows = $source->getRows($filters);  // merged + deduped + sorted
// $source->getTrace() → per-source row counts + timings for demos/debugging