kriss/log-reader

Log Reader For PHP

v1.3.6 2024-07-18 03:24 UTC

This package is auto-updated.

Last update: 2024-09-18 03:39:45 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