Download the PHP package php-tui/term without Composer

On this page you can find all versions of the php package php-tui/term. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package term

PHP Term

CI

Term Logo

Low-level terminal control library heavily inspired by crossterm.

Table of Contents

Installation

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 for inspiration and start a PR.

Usage

Actions

You can send data to the terminal using actions.

All actions are made available via. the Actions factory:

method description
Actions::requestCursorPosition Request the cursor position.

This will (hopefully) be returned by the terminal and will be provided
as an PhpTui\Term\Event\CursorPositionEvent.
Actions::alternateScreenEnable Enable the alternate screen.

Allows switching back to the users previous "screen" later.
Actions::alternateScreenDisable Disable the alternate screen
Actions::printString Echo a standard string to the terminal
Actions::cursorShow Show the cursor
Actions::cursorHide Hide the cursor
Actions::setRgbForegroundColor Set the foreground color using RGB
Actions::setRgbBackgroundColor Set the background color using RGB
Actions::setForegroundColor Set the foreground color to one of the ANSI base colors
Actions::setBackgroundColor Set the background color to one of the ANSI base colors
Actions::moveCursor Move the cursor to an absolute position.

The top left cell is 0,0.
Actions::reset Reset all modes (styles and colors)
Actions::bold Enable or disable the bold styling
Actions::dim Enable or disable the dim styling
Actions::italic Enable or disable the italic styling
Actions::underline Enable or disable the underline styling
Actions::slowBlink Enable or disable the slow blink styling
Actions::rapidBlink Enable or disable the rapid blink styling
Actions::reverse Enable or disable the reverse blink styling
Actions::hidden Enable or disable the hidden styling - useful for passwords.
Actions::strike Enable or disable the strike-through styling
Actions::clear Perform a clear operation.

The type of clear operation is given with the Enum for example

Actions::clear(ClearType::All)

Will clear the entire screen.
Actions::enableMouseCapture Enable mouse capture.

Once this action has been issued mouse events will be made available.
Actions::disableMouseCapture Disable mouse capture
Actions::scrollUp Scroll the terminal up the given number of rows
Actions::scrollDown Scroll the terminal down the given number of rows
Actions::setTitle Set the title of the terminal for the current process.
Actions::lineWrap Enable or disable line wrap
Actions::moveCursorNextLine Move the cursor down and to the start of the next line (or the given number of lines)
Actions::moveCursorPreviousLine Move the cursor up and to the start of the previous line (or the given number of lines)
Actions::moveCursorToColumn Move the cursor to the given column (0 based)
Actions::moveCursorToRow Move the cursor to the given row (0 based)
Actions::moveCursorUp Move cursor up 1 or the given number of rows.
Actions::moveCursorRight Move cursor right 1 or the given number of columns.
Actions::moveCursorDown Move cursor down 1 or the given number of rows.
Actions::moveCursorLeft Move cursor left 1 or the given number of columns.
Actions::saveCursorPosition Save the cursor position
Actions::restoreCursorPosition Restore the cursor position
Actions::enableCusorBlinking Enable cursor blinking
Actions::disableCursorBlinking Disable cursor blinking
Actions::setCursorStyle Set the cursor style

Events

Term provides user events:

The events are as follows:

Terminal Size

You can request the terminal size:

Raw Mode

Raw mode disables all the default terminal behaviors and is what you typically want to enable when you want a fully interactive terminal.

Always be sure to disable raw mode as it will leave the terminal in a barely useable state otherwise!

Parsing

In addition Term provides a parser which can parse any escape code emitted by the actions.

This is useful if you want to capture the output from a terminal application and convert it to a set of Actions which can then be redrawn in another medium (e.g. plain text or HTML).

Testing

The Terminal has testable versions of all it's dependencies:

See the example testable.php in examples/.

Contributing

PRs for missing functionalities and improvements are charactr.


All versions of term with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package php-tui/term contains the following files

Loading the files please wait ....