PHP code example of klisl / yii2-statistics

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

    

klisl / yii2-statistics example snippets



return [

    'statistics' => [

        'days_default' => 3, //кол-во дней для вывода статистики по-умолчанию (сегодня/вчера/...)

        'password' => 'klisl', //пароль для входа на страницу статистики. Если false (без кавычек) - вход без пароля

        'authentication' => false, //если true, то статистика доступна только аутентифицированным пользователям

        'auth_route' => 'site/login', //контроллер/действие для страницы аутентификации (по-умолчанию 'site/login')

        'date_old' => 90 //удалять данные через х дней
    ]
…


public function behaviors()
{
    return [

        'statistics' => [
            'class' => \Klisl\Statistics\AddStatistics::class,
            'actions' => ['index', 'contact'],
        ],
…


$this->attachBehavior('statistics', [
    'class' => \Klisl\Statistics\AddStatistics::class,
    'actions' => [$this->action->id]
]);