https://github.com/aternosorg/codex-minecraft
PHP library to read, parse, print and analyse Minecraft log files.
https://github.com/aternosorg/codex-minecraft
Last synced: about 1 year ago
JSON representation
PHP library to read, parse, print and analyse Minecraft log files.
- Host: GitHub
- URL: https://github.com/aternosorg/codex-minecraft
- Owner: aternosorg
- License: mit
- Created: 2019-02-18T13:11:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-03-21T14:57:24.000Z (about 1 year ago)
- Last Synced: 2025-03-30T09:06:25.796Z (about 1 year ago)
- Language: PHP
- Homepage: https://packagist.org/packages/aternos/codex-minecraft
- Size: 3.94 MB
- Stars: 30
- Watchers: 6
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Codex for Minecraft
### 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](https://github.com/aternosorg/codex), for more
information take a look at the Codex repository: [aternosorg/codex](https://github.com/aternosorg/codex)
### Create a log file
*[see [codex#logfile](https://github.com/aternosorg/codex#logfile)]*
```php
setLogFile($logFile);
```
### Detect the log type
*[see [codex#detection](https://github.com/aternosorg/codex#detection)]*
If you don't know the log type, you can let the [Detective](src/Detective/Detective.php) decide and create a log object.
```php
setLogFile($logFile);
$log = $detective->detect();
```
### Parse the log content
*[see [codex#parsing](https://github.com/aternosorg/codex#parsing)]*
```php
parse();
```
### Analyse the log
*[see [codex#analysing](https://github.com/aternosorg/codex#analysing)]*
```php
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`](src/Analysis/Solution/File/FileDeleteSolution.php).
```php
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`](src/Translator/Translator.php). The available
translations are in the [`lang`](lang) folder. They are not complete (yet) and you can help to translate them here: [https://crowdin.com/project/aternos](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](TRANSLATION.md)
```php
setLanguage("de");
```