aternos / codex-minecraft
PHP library to read, parse, print and analyse Minecraft log files.
Installs: 15 280
Dependents: 0
Suggesters: 0
Security: 0
Stars: 31
Watchers: 7
Forks: 7
Open Issues: 1
Requires
- php: >=8.1.0
- ext-json: *
- aternos/codex: ^2.2.0
Requires (Dev)
- phpunit/phpunit: ^10.2
- dev-master
- v3.6.0
- v3.5.0
- v3.4.0
- v3.3.0
- v3.2.0
- v3.1.0
- v3.0.2
- v3.0.1
- v3.0.0
- v2.10.2
- v2.10.1
- v2.10.0
- v2.9.0
- v2.8.3
- v2.8.2
- v2.8.1
- v2.8.0
- v2.7.0
- v2.6.0
- v2.5.3
- v2.5.2
- v2.5.1
- v2.5.0
- v2.4.0
- v2.3.2
- v2.3.1
- v2.3.0
- v2.2.1
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.1
- v2.0.0
- v1.13.1
- v1.13.0
- v1.12.1
- v1.12.0
- v1.11.4
- v1.11.3
- v1.11.2
- v1.11.1
- v1.11.0
- v1.10.1
- v1.10.0
- v1.9.0
- v1.8.2
- v1.8.1
- v1.8.0
- v1.7.0
- v1.6.0
- v1.5.7
- v1.5.6
- v1.5.5
- v1.5.4
- v1.5.3
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.2
- v1.1.1
- v1.0.1
- v1.0.0
- v0.4.0
- v0.3.0
- v0.2.8
- v0.2.7
- v0.2.6
- v0.2.5
- v0.2.4
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2.0
- v0.1.1
- v0.1.0
- dev-remove-unused-imports
- dev-mod-wrong-minecraft-version
This package is auto-updated.
Last update: 2024-12-20 14:40:43 UTC
README
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. This is the implementation for Minecraft logs including detectors, parsers and analysers to work with different Minecraft log files.
Installation
composer require aternos/codex-minecraft
Usage
This is only an introduction to the Minecraft implementation of Codex, for more information take a look at the Codex repository: aternosorg/codex
Create a log file
[see codex#logfile]
<?php $logFile = new \Aternos\Codex\Log\File\StringLogFile("This is the log content"); $logFile = new \Aternos\Codex\Log\File\PathLogFile("/path/to/log"); $logFile = new \Aternos\Codex\Log\File\StreamLogFile(fopen("/path/to/log", "r"));
Create log object
[see codex#log]
If you know the log type, you can directly create a new log object.
<?php $log = new \Aternos\Codex\Minecraft\Log\Minecraft\Vanilla\VanillaServerLog(); $log->setLogFile($logFile);
Detect the log type
[see codex#detection]
If you don't know the log type, you can let the Detective decide and create a log object.
<?php $detective = new \Aternos\Codex\Minecraft\Detective\Detective(); $detective->setLogFile($logFile); $log = $detective->detect();
Parse the log content
[see codex#parsing]
<?php $log->parse();
Analyse the log
[see codex#analysing]
<?php $analysis = $log->analyse();
The $analysis
object contains problems and information which you can get with the $analysis->getProblems()
and $analysis->getInformation()
functions
or all insights together with $analysis->getInsights()
. The problems contain solutions, a few of them could be solved automatically. They implement the
\Aternos\Codex\Analysis\AutomatableSolutionInterface
, e.g. FileDeleteSolution
.
<?php foreach ($analysis->getInformation() as $information) { echo $information->getLabel() . ": " . $information->getValue(); } foreach ($analysis->getProblems() as $problem) { echo $problem->getMessage(); foreach($problem->getSolutions() as $solution) { echo $solution->getMessage(); } }
Translations
The output messages, e.g. for problems and solutions are translated by the Translator
. The available
translations are in the lang
folder. They are not complete (yet) and you can help to translate them here: https://crowdin.com/project/aternos.
You can set the translation language with the setLanguage()
function before using any getMessage()
function.
See the current translation status here: TRANSLATION.md
<?php \Aternos\Codex\Minecraft\Translator\Translator::getInstance()->setLanguage("de");