PHPackages                             geekdevs/cli-highlighter - 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. geekdevs/cli-highlighter

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

geekdevs/cli-highlighter
========================

Library which is used to colorize syntax of xml, yaml and json in console.

1.0.3(7y ago)0315[1 issues](https://github.com/geekdevs/cli-highlighter/issues)2PHP

Since Mar 18Pushed 7y ago1 watchersCompare

[ Source](https://github.com/geekdevs/cli-highlighter)[ Packagist](https://packagist.org/packages/geekdevs/cli-highlighter)[ RSS](/packages/geekdevs-cli-highlighter/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (2)Versions (5)Used By (2)

About
=====

[](#about)

This is a syntax highlighter library used to colorize output of xml, json and yaml formats to be displayed in command-line utilities.

Installation
------------

[](#installation)

`composer require geekdevs/cli-highlighter`

Usage
-----

[](#usage)

### Use individual highlighters:

[](#use-individual-highlighters)

```
$highlighter = new JsonHighlighter($jsonOptions);
echo $highlighter->highlight($input);

$highlighter = new XmlHighlighter($xmlOptions);
echo $highlighter->highlight($input);

$highlighter = new YamlHighlighter($yamlOptions);
echo $highlighter->highlight($input);

```

### Use helper service for multiple formats

[](#use-helper-service-for-multiple-formats)

```
$options = [
    'json' => [
        'keys'   => 'magenta',
        'values' => 'green',
        'braces' => 'light_white',
    ],

    'xml' => [
        'elements'   => 'yellow',
        'attributes' => 'green',
        'values'     => 'green',
        'innerText'  => 'light_white',
        'comments'   => 'gray',
        'meta'       => 'yellow',
    ],

    'yaml' => [
        'separators' => 'blue',
        'keys'       => 'yellow',
        'values'     => 'light_white',
        'comments'   => 'gray',
    ],
];

$highlighter = new \CliHighlighter\Service\Highlighter($options);

echo $highlighter->highlight($input, 'json');
echo $highlighter->highlight($input, 'xml');
echo $highlighter->highlight($input, 'yaml');

```

### Use as console tool

[](#use-as-console-tool)

You can use `vendor/bin/highlighter` script with preconfigured colors for json, xml, yaml. Like this

```
vendor/bin/highlighter json < input.json
vendor/bin/highlighter xml < input.xml
vendor/bin/highlighter yaml < yaml.xml

```

Alternativelym you can pipe this command like so:

```
echo "" | vendor/bin/highlighter xml

```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

4

Last Release

2663d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c32f742614130f40944df419b067a2d308175dfcc1ea2ced80a37885585aa53?d=identicon)[geekdevs](/maintainers/geekdevs)

---

Top Contributors

[![geekdevs](https://avatars.githubusercontent.com/u/864822?v=4)](https://github.com/geekdevs "geekdevs (4 commits)")

### Embed Badge

![Health badge](/badges/geekdevs-cli-highlighter/health.svg)

```
[![Health](https://phpackages.com/badges/geekdevs-cli-highlighter/health.svg)](https://phpackages.com/packages/geekdevs-cli-highlighter)
```

###  Alternatives

[drush/drush

Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.

2.4k60.6M793](/packages/drush-drush)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k13](/packages/tempest-framework)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

54642.4k4](/packages/jolicode-castor)[crazywhalecc/static-php-cli

Build single static PHP binary, with PHP project together, with popular extensions included.

1.9k17.6k](/packages/crazywhalecc-static-php-cli)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k49](/packages/friendsoftypo3-content-blocks)

PHPackages © 2026

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