PHPackages                             code-lts/cli-tools - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. code-lts/cli-tools

ActiveLibrary[CLI &amp; Console](/categories/cli)

code-lts/cli-tools
==================

CLI tools to manage output errors formatting for junit, checkstyle, teamcity, gitlab and github error formats

v1.7.0(3mo ago)295.1k↑41.3%1MPL-2.0PHPPHP ^8.1CI passing

Since Nov 26Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/code-lts/cli-tools)[ Packagist](https://packagist.org/packages/code-lts/cli-tools)[ Docs](https://github.com/code-lts/cli-tools)[ RSS](/packages/code-lts-cli-tools/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (11)Used By (1)

CLI tools
=========

[](#cli-tools)

[![codecov](https://camo.githubusercontent.com/e1320a79c16837d19ab7fe10519797c81237dd9385304a7f28cae228369ea4b7/68747470733a2f2f636f6465636f762e696f2f67682f636f64652d6c74732f636c692d746f6f6c732f6272616e63682f6d61696e2f67726170682f62616467652e7376673f6272616e63683d6d61696e)](https://codecov.io/gh/code-lts/cli-tools?branch=main)[![Version](https://camo.githubusercontent.com/afc0ce478aa09e797e7ec2385a4a060076cfd29e849efffe7e4db4e63a643e19/68747470733a2f2f706f7365722e707567782e6f72672f636f64652d6c74732f636c692d746f6f6c732f76657273696f6e)](//packagist.org/packages/code-lts/cli-tools)[![License](https://camo.githubusercontent.com/950ded7994778e73b7cc026f23e171fb3d184f0d518917c415fdcef968823041/68747470733a2f2f706f7365722e707567782e6f72672f636f64652d6c74732f636c692d746f6f6c732f6c6963656e7365)](//packagist.org/packages/code-lts/cli-tools)

CLI tools to manage output errors formatting for junit, checkstyle, teamcity, gitlab and github error formats.

Motivation
----------

[](#motivation)

Have formatters that I can re-use in projects to format errors. Some code is copied from phpstan. See [\#4122](https://github.com/phpstan/phpstan/issues/4122)

Example usages
--------------

[](#example-usages)

### Format errors

[](#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

[](#readwrite-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

[](#ansi-codes)

```
use CodeLts\CliTools\File\AnsiEscapeSequences;

$this->output->writeFormatted(AnsiEscapeSequences::ERASE_TO_LINE_END);
```

### Detect a CI

[](#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
```

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance78

Regular maintenance activity

Popularity34

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 99.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~209 days

Recently: every ~469 days

Total

10

Last Release

117d ago

PHP version history (3 changes)v1.0.0PHP ^7.1 || ^8.0

v1.6.0PHP ^7.2 || ^8.0

v1.7.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25723041?v=4)[Wdes](/maintainers/wdes)[@wdes](https://github.com/wdes)

---

Top Contributors

[![williamdes](https://avatars.githubusercontent.com/u/7784660?v=4)](https://github.com/williamdes "williamdes (105 commits)")[![mtvbrianking](https://avatars.githubusercontent.com/u/5412360?v=4)](https://github.com/mtvbrianking "mtvbrianking (1 commits)")

---

Tags

checkstylecheckstyle-xml-reportclicli-toolsformattersgithubgitlabgitlab-cijunitjunit-xmlphpphp8teamcityteamcity-formattercligithubgitlabteamcityformattersjunitcheckstyle

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/code-lts-cli-tools/health.svg)

```
[![Health](https://phpackages.com/badges/code-lts-cli-tools/health.svg)](https://phpackages.com/packages/code-lts-cli-tools)
```

###  Alternatives

[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k239.8M286](/packages/nunomaduro-termwind)[ondram/ci-detector

Detect continuous integration environment and provide unified access to properties of current build

22249.4M33](/packages/ondram-ci-detector)[jbzoo/ci-report-converter

The tool converts different error reporting standards for deep integration with popular CI systems (TeamCity, IntelliJ IDEA, GitHub Actions, etc)

30784.4k2](/packages/jbzoo-ci-report-converter)[laminas/laminas-cli

Command-line interface for Laminas projects

563.7M54](/packages/laminas-laminas-cli)[guanguans/ai-commit

Automagically generate conventional git commit message with AI. - 使用 AI 自动生成约定式 git 提交信息。

39231.2k10](/packages/guanguans-ai-commit)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
