PHP code example of syofyanzuhad / lumina-core

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

    

syofyanzuhad / lumina-core example snippets


use Lumina\Core\Middleware\TrackPageview;

Route::middleware([TrackPageview::class])->group(function () {
    Route::get('/', [HomeController::class, 'index']);
});

use Lumina\Core\Services\AnalyticsService;

$analytics = app(AnalyticsService::class);

// Dashboard overview payload (Pageviews, Visitors, Referrers, Devices, OS, Browsers, Countries, Goals)
$overview = $analytics->getOverview($site, $start, $end);

// Enhanced Data Detection aggregations
$topBrowsers = $analytics->getTopBrowsers($site, $start, $end, limit: 10);
$topOS = $analytics->getTopOperatingSystems($site, $start, $end, limit: 10);
$topCountries = $analytics->getTopCountries($site, $start, $end, limit: 10);

// Custom Event tracking metrics
$customEvents = $analytics->getCustomEvents($site, $start, $end);
$propertyBreakdown = $analytics->getCustomEventPropertyBreakdown($site, 'signup_completed', 'plan', $start, $end);

// Goal & Conversion calculation
$goals = $analytics->getGoals($site, $start, $end);
bash
php artisan vendor:publish --tag=lumina-core-migrations
php artisan migrate