PHPackages                             chemaclass/phel-cli-gui - 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. chemaclass/phel-cli-gui

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

chemaclass/phel-cli-gui
=======================

Phel functions to render in the terminal. It uses the Cursor from the Symfony Command module.

0.15.0(1w ago)5232[1 issues](https://github.com/Chemaclass/phel-cli-gui/issues)1MITPHPPHP &gt;=8.4CI passing

Since Oct 21Pushed 1w ago2 watchersCompare

[ Source](https://github.com/Chemaclass/phel-cli-gui)[ Packagist](https://packagist.org/packages/chemaclass/phel-cli-gui)[ Docs](https://phel-lang.org/)[ RSS](/packages/chemaclass-phel-cli-gui/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (21)Versions (18)Used By (1)

Phel CLI GUI
============

[](#phel-cli-gui)

[![CI](https://github.com/Chemaclass/phel-cli-gui/actions/workflows/ci.yml/badge.svg)](https://github.com/Chemaclass/phel-cli-gui/actions/workflows/ci.yml)[![Packagist](https://camo.githubusercontent.com/0cdb484fd108b9f82dbc48200dd64c9664be9d43051def58869f3cb911f1742d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6368656d61636c6173732f7068656c2d636c692d677569)](https://packagist.org/packages/chemaclass/phel-cli-gui)[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

Build rich terminal interfaces in [Phel](https://phel-lang.org/) — render text at arbitrary coordinates, draw framed boxes, paint regions, read raw keypresses, and style output with named formatters.

Powered by Symfony's [Console Cursor](https://symfony.com/doc/current/console/coloring.html), exposed behind a small, data-first Phel API.

[![Diff-rendered demo animation](docs/demo.gif)](docs/demo.gif)

- Works with any TTY (ANSI-capable).
- Zero globals — one managed `TerminalGui` singleton per process.
- Raw key events, one per tick (`read-key`) or drained per frame (`read-keys`) — held keys stay responsive.
- Named styles from 4-bit colours up to xterm-256 and 24-bit truecolor.
- Frame batching flushes a whole repaint in one write; diff rendering writes only the cells that changed — see [docs/api.md](docs/api.md#diff-rendering).
- Pure helpers (`parse-keys`, `color->sgr`, `make-border-style`) are easy to test without a real terminal.

Requirements
------------

[](#requirements)

- PHP 8.4+
- `ext-pcntl`, `ext-posix`, `ext-readline`
- Phel `^0.49`

Install
-------

[](#install)

```
composer require chemaclass/phel-cli-gui
```

Require the namespace in your Phel file:

```
(ns my-app.main
  (:require phel-cli-gui.terminal-gui :refer [render read-key draw-box clear-screen]))

```

Quick start
-----------

[](#quick-start)

Draw a bordered box, render text inside it, wait for a key, quit.

```
(ns my-app.hello
  (:require phel-cli-gui.terminal-gui
            :refer [clear-screen draw-box render read-key cleanup-gui]))

(defn main []
  (clear-screen)
  (draw-box {:x 2 :y 1 :width 30 :height 5 :fill-char \space})
  (render 4 3 "Press any key to exit")
  (loop []
    (if (read-key)
      (cleanup-gui)
      (do (php/usleep 10000) (recur)))))

(main)

```

Run:

```
vendor/bin/phel run src/phel/hello.phel
```

Docs
----

[](#docs)

- [API reference](docs/api.md) — every public function, grouped by concern.
- [Recipes](docs/recipes.md) — copy-paste patterns (diff loop, bordered UI, …).

Example projects
----------------

[](#example-projects)

- [phel-snake](https://github.com/Chemaclass/phel-snake) — classic Snake built with this library.

Development
-----------

[](#development)

```
composer install
composer test          # Phel tests + PHPUnit (test:phel / test:php to scope)
composer test:coverage # same suites with line-coverage reports (needs xdebug/pcov)
composer format        # phel format
composer bench         # render/paint/diff timings at 120x40 and 240x70
```

Layout: `src/phel/` public API · `src/php/` rendering core (Symfony Console wrapper + pure helpers) · `tests/` Phel, PHPUnit &amp; bashunit suites · `tools/`release automation.

Cut a release with `tools/release.sh ` (add `--dry-run` to preview) — it gates, rolls the CHANGELOG, tags, pushes, and publishes the GitHub release.

AI-assistant config is managed with [agnostic-ai](https://github.com/Chemaclass/agnostic-ai): edit the source under `.agnostic-ai/`, run `agnostic-ai sync`; the per-tool files (`CLAUDE.md`, `.claude/…`) are generated and git-ignored.

License
-------

[](#license)

MIT © [Jose M Valera Reales](https://chemaclass.com)

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance94

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity60

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 ~68 days

Recently: every ~14 days

Total

16

Last Release

9d ago

PHP version history (5 changes)0.1.0PHP ^8.0

0.2.0PHP ^8.2

0.3.1PHP &gt;=8.2

0.5.0PHP &gt;=8.3

0.11.0PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d166420c6770c5941e10bd68b2d26501eabb432e280d8e6eba0a344bcc1e5ae?d=identicon)[Chemaclass](/maintainers/Chemaclass)

---

Top Contributors

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

---

Tags

cliphelphpterminallanguagefunctionallispphel

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/chemaclass-phel-cli-gui/health.svg)

```
[![Health](https://phpackages.com/badges/chemaclass-phel-cli-gui/health.svg)](https://phpackages.com/packages/chemaclass-phel-cli-gui)
```

###  Alternatives

[phel-lang/phel-lang

Phel is a functional programming language that compiles to PHP

5196.5k22](/packages/phel-lang-phel-lang)

PHPackages © 2026

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