Download the PHP package aspectus/terminal without Composer

On this page you can find all versions of the php package aspectus/terminal. 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 terminal

Terminal device

This is an open-source PHP package providing a small abstraction for the terminal. The idea is to see the terminal as a device, which can perform both input and output. The package relies on Amphp to provide non-blocking handling of the streams and an event dispatcher to handle input.

Furthermore, this package also provides an abstraction for Xterm that is using the terminal device, supporting most of the escape control sequences in the manual (patch #379) as well dispatching events for handling mouse movement.

Usage

Basic Output

Basic Input

For handling the input you can rely on the supplied EventDispatcher.

Device Input Events

The current implementation will distinguish between normal input events (InputEvent) and input that is an escape sequence (EscapeSequenceEvent), so your listeners can attach to the correct one. Unless you need to read some escape sequence that the terminal sends back to you, you probably need to listen to InputEvent.

InputEvent - the default event that is emitted.

EscapeSequenceEvent - this is emitted when input starts with an escape sequence

All events hold a reference to the device that dispatched them into the $event->device property.

For Xterm events see below.

Event Factory

The device by default has a minimal implementation for creating new events. You can supply your own by implementing the EventFactoryInterface.

Xterm abstraction

The package comes with an abstraction for Xterm that provides named methods to escape sequences in a fluent interface. Xterm will buffer every call and write it to the device when flush() is called or return it as a string when getBuffered() is called.

Xterm Input events

Using the Xterm abstraction will add a different EventFactory implementation which will emit some additional events when they are received.

SpecialKeyEvent is emitted when function or arrow keys are pressed. The data property of the event is mapped to a generic format, indicating function keys like <F2> and arrow keys like <LEFT>, <RIGHT>.

MouseInputEvent - is emitted when mouse tracking is enabled and provides properties like x and y as well as methods for the buttons (like button1()) to get information about which buttons were pressed.

MouseFocusEvent - is emitted when mouse tracking and focus tracking have been enabled and provides a way to attach to an event that will trigger when the window loses focus or gains it again.

More usage examples

More usage examples can be found in the examples/ directory.

Contribute

Everyone is welcome to contribute, please see CONTRIBUTE.md for more information.

Licence

MIT


All versions of terminal with dependencies

PHP Build Version
Package Version
Requires amphp/byte-stream Version ^2.0
amphp/amp Version ^3
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 aspectus/terminal contains the following files

Loading the files please wait ....