PHP code example of kriss / log-reader

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

    

kriss / log-reader example snippets


use Kriss\LogReader\Traits\LogReaderControllerTrait;
use Kriss\LogReader\LogReader;

class SomeController {
    use LogReaderControllerTrait;
    
    private $logReader;
    
    protected function getLogReader(): LogReader
    {
        if (!$this->logReader) {
            //$runtimePath = __DIR__ . '/../runtime/logs';
            $this->logReader = new LogReader($runtimePath, [
                'enable' => true,
                'deleteEnable' => true,
                // others
            ]);
        }
        return $this->logReader;
    }

    protected function getRequest(): SymfonyRequest
    {
        return request()->getSymfonyRequest();
    }

    protected function getBaseUrl(): string
    {
        return 'some/url-prefix';
    }
}