PHPackages                             php-tui/term - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. php-tui/term

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

php-tui/term
============

comprehensive low level terminal control

0.3.4(2y ago)451.0M↓52.6%7[2 issues](https://github.com/php-tui/term/issues)[3 PRs](https://github.com/php-tui/term/pulls)1MITPHPPHP ^8.1CI passing

Since Nov 27Pushed 1y ago3 watchersCompare

[ Source](https://github.com/php-tui/term)[ Packagist](https://packagist.org/packages/php-tui/term)[ RSS](/packages/php-tui-term/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (3)Dependencies (4)Versions (9)Used By (1)

PHP Term
========

[](#php-term)

[![CI](https://github.com/php-tui/term/actions/workflows/ci.yml/badge.svg)](https://github.com/php-tui/term/actions/workflows/ci.yml)

 [![Term Logo](https://private-user-images.githubusercontent.com/530801/286207555-ca7a8e17-2238-496d-aaa8-83c92f2f5009.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODI2NzU2MzMsIm5iZiI6MTc4MjY3NTMzMywicGF0aCI6Ii81MzA4MDEvMjg2MjA3NTU1LWNhN2E4ZTE3LTIyMzgtNDk2ZC1hYWE4LTgzYzkyZjJmNTAwOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYwNjI4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT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)

Low-level terminal control library **heavily** inspired by [crossterm](https://github.com/crossterm-rs/crossterm).

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Requiremens](#requirements)
- [Usage](#usage)
    - [Actions](#actions)
    - [Events](#events)
    - [Terminal Size](#terminal-size)
    - [Raw Mode](#raw-mode)
    - [ANSI parsing](#parsing)
- [Testing](#testing)
- [Contributing](#contributing)

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

[](#installation)

```
$ composer require php-tui/term

```

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

[](#requirements)

I have only tested this library on Linux. It currently requires `stty` to enable the raw mode and detect the current window size. It should work on MacOS and WSL.

Native **Windows** is currently not supported as I cannot test on Windows, the architecture should support Windows however, so if you'd like to make a start look at [crossterm](https://github.com/crossterm-rs/crossterm/blob/master/src/style/sys/windows.rs)for inspiration and start a PR.

Usage
-----

[](#usage)

### Actions

[](#actions)

You can send data to the terminal using *actions*.

```
