Skip to content

krissss/php-log-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Log Reader For PHP

preview

Installation

composer require kriss/log-reader

Usage

Use LogReaderControllerTrait in controller

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';
    }
}

For Laravel

see example