PHP code example of injic / laravel-statcounter
1. Go to this page and download the library: Download injic/laravel-statcounter 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/ */
injic / laravel-statcounter example snippets
Injic\LaravelStatcounter\LaravelStatcounterServiceProvider::class,
'Stat' => Injic\LaravelStatcounter\Facades\Stat::class,
// Retrieve an array of browser objects (http://api.statcounter.com/docs/v3#browsers)
$stats = Stat::browsers()->get();
// Retrieve an array of summary objects (http://api.statcounter.com/docs/v3#summary-daily)
$now = \Carbon\Carbon::now(); // http://carbon.nesbot.com/
$stats = Stat::summary()->setRange(Granularity::DAILY, $now->subWeek(), $now)->get();
// Paginate the recent visitor objects (http://api.statcounter.com/docs/v3#visitors)
// https://laravel.com/docs/5.2/pagination
$stats = Stat::recentVisitors()->paginate(20);
// Add new project to StatCounter with the project name, project url, and project timezone
$project Stat::addProject('project-name','www.example.com','America/Chicago');
<html>
<body>
<!-- Prints the StatCounter tracker using Laravel Templates -->
{!! Stat::tracker() !!}
</body>
</html>