code-lts/cli-tools
Composer 安装命令:
composer require code-lts/cli-tools
包简介
CLI tools to manage output errors formatting for junit, checkstyle, teamcity, gitlab and github error formats
README 文档
README
CLI tools to manage output errors formatting for junit, checkstyle, teamcity, gitlab and github error formats.
Motivation
Have formatters that I can re-use in projects to format errors. Some code is copied from phpstan. See #4122
Example usages
Format errors
use CodeLts\CliTools\Error; use CodeLts\CliTools\AnalysisResult; use CodeLts\CliTools\OutputFormat; use CodeLts\CliTools\Exceptions\FormatNotFoundException; // if the value is from an user input // Will throw FormatNotFoundException // See valid formats at OutputFormat::VALID_OUTPUT_FORMATS OutputFormat::checkOutputFormatIsValid('notValidFormat'); $fileSpecificErrors = [ new Error( 'My error message', '/file/path/to/File.php', 15 // Line number ), ]; $notFileSpecificErrors = [ 'Just an error message', ]; $internalErrors = [ 'Oops the internal engine did crash !', ]; $warnings = [ 'I warn you that most of this code is tested', 'Contributions are very welcome', ]; $analysisResult = new AnalysisResult( $fileSpecificErrors, $notFileSpecificErrors, $internalErrors, $warnings ); OutputFormat::displayUserChoiceFormat( OutputFormat::OUTPUT_FORMAT_TABLE,// The phpstan table error format, you can have a lot more formats in OutputFormat::VALID_OUTPUT_FORMATS $analysisResult, $this->sourceRootDirectory,// can be null, if null the error paths will not be pretty and will be displayed as given $this->output // Implement CodeLts\CliTools\Output or use CodeLts\CliTools\Symfony\SymfonyOutput );
Read/Write files
use CodeLts\CliTools\File\FileReader; use CodeLts\CliTools\File\FileWriter; $fileName = 'myFile.txt'; FileWriter::write( $fileName, 'Some data, blob, blob, blob.' ); FileReader::read($fileName);// -> Some data, blob, blob, blob.
ANSI codes
use CodeLts\CliTools\File\AnsiEscapeSequences; $this->output->writeFormatted(AnsiEscapeSequences::ERASE_TO_LINE_END);
Detect a CI
use CodeLts\CliTools\Utils; // See supported CIs at https://github.com/OndraM/ci-detector#supported-continuous-integration-servers Utils::isCiDetected(); // true of false
code-lts/cli-tools 适用场景与选型建议
code-lts/cli-tools 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 104.93k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 11 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cli」 「github」 「junit」 「gitlab」 「formatters」 「teamcity」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 code-lts/cli-tools 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 code-lts/cli-tools 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 code-lts/cli-tools 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Handles basic OAuth/OAuth2 authentication along with classes for common services
MediaWiki extension that allows embedding external content, specified by URL, into your wiki pages
A thin wrapper around the SqlParser from the phpMyAdmin project which can be used to lint any amount of sql files from the command line.
Behat extension that reports with the JUnit format and is compatible with Moodle reruns.
Behat extension that reports with the JUnit format and is compatible with Moodle reruns.
Balances PHPUnit test execution across parallel jobs based on JUnit XML timing data
统计信息
- 总下载量: 104.93k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 35
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MPL-2.0
- 更新时间: 2020-11-25