Download the PHP package aternos/codex without Composer
On this page you can find all versions of the php package aternos/codex. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aternos/codex
More information about aternos/codex
Files in aternos/codex
Package codex
Short Description PHP library to read, parse, print and analyse log files.
License MIT
Informations about the package codex
Codex
About
Codex (lat. roughly for "log") is a PHP library to read, parse, print and analyse log files to find problems and suggest possible solutions. It was created mainly for Minecraft server logs but could be used for any other logs as well. This library provides a set up for a structured log parsing implementation and provides some useful basic implementation, mainly based on RegEx. Every part of this library can or even must be extended/overwritten while still following the interfaces, which ensure interoperability between the different parts of this library.
Installation
Usage
This is a short introduction to the idea of Codex, for some more examples check the test folder and/or read the code.
Logfile
A LogFileInterface
object is required
to start reading a log. There are currently three different log file classes in this library.
Log
A LogInterface
is the most important object
for the different operations. It represents the log content, which is split in Lines.
And it offers quick access to the detection, parsing and analysing functions and can define which classes are used
for those functions. If you know which log type you have or just want to test the default Log class, you can
directly create a new instance, otherwise you can use detection as described below.
Detection
If the log type (specifically the class name of the log type) is unknown you can use the Detective
class
to automatically detect the log type. The Detective
class gets a list of possible log class names and executes
their given Detectors.
The detect()
function always returns a log object, if necessary it defaults to Log
.
Parsing
Parsing reads the entire log and creates the Line
objects which
are parts of a Log
object. Different log types can use different parsers by overwriting the
LogInterface::getDefaultParser()
function or by passing a parser object to the parse function.
Analysing
An analysis is performed by an AnalysableLog
and returns
an Problem
or an Information
object. Different log types can use different analysers by overwriting
the AnalysableLogInterface::getDefaultAnalyser()
function or by passing an analyser object to the analyse function.
Printing
The entire Printer
. The basic
ModifiableDefaultPrinter
allows Modification
, e.g. to highlight certain characters/words.