kriss/log-reader

Log Reader For PHP

v1.3.5 2023-05-08 10:49 UTC

This package is auto-updated.

Last update: 2024-06-08 13:06:55 UTC


README

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