aternos/codex-minecraft
Composer 安装命令:
composer require aternos/codex-minecraft
包简介
PHP library to read, parse, print and analyse Minecraft log files.
README 文档
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");
aternos/codex-minecraft 适用场景与选型建议
aternos/codex-minecraft 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17.5k 次下载、GitHub Stars 达 39, 最近一次更新时间为 2019 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 aternos/codex-minecraft 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aternos/codex-minecraft 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17.5k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 40
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-18