PHP code example of bnomei / kirby3-pageviewcounter

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

    

bnomei / kirby3-pageviewcounter example snippets


 echo $page->counterImage(); 

 echo $page->counterCss(); 


return [
    /* default 
    'bnomei.pageviewcounter.counter' => function () {
        return new \Bnomei\PageViewCounterSQLite();
    },
    'bnomei.pageviewcounter.sqlite.file' => function () {
        $dir = realpath(kirby()->roots()->accounts() . '/../');
        Dir::make($dir);
        return $dir . '/pageviewcounter.sqlite';
    },
    */
    // other options ...
];


return [ 
    'bnomei.pageviewcounter.field.count' => 'viewcount',
    'bnomei.pageviewcounter.field.timestamp' => 'lastvisited',
    'bnomei.pageviewcounter.counter' => function () {
            return new \Bnomei\PageViewCounterField();
    },
    // other options ...
];