PHPackages                             atatusoft-ltd/php-key-listener - 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. atatusoft-ltd/php-key-listener

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

atatusoft-ltd/php-key-listener
==============================

A PHP based API to capture key presses from the terminal.

0.2.1(3y ago)011MITPHPPHP &gt;=8.2

Since Mar 9Pushed 3y agoCompare

[ Source](https://github.com/atatusoft-ltd/php-key-listener)[ Packagist](https://packagist.org/packages/atatusoft-ltd/php-key-listener)[ Docs](https://atatusoft.com)[ RSS](/packages/atatusoft-ltd-php-key-listener/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

PHKey
=====

[](#phkey)

PHP based command line key listener.

[![Example](https://camo.githubusercontent.com/e786e0f0cd65d199a4330dda77602bbda20776e07f6f790eb0b4fd5c9cbe1fe4/68747470733a2f2f696265722e6c742f6173736574732f696d616765732f70726f6a656374732f70686b65792e676966)](https://camo.githubusercontent.com/e786e0f0cd65d199a4330dda77602bbda20776e07f6f790eb0b4fd5c9cbe1fe4/68747470733a2f2f696265722e6c742f6173736574732f696d616765732f70726f6a656374732f70686b65792e676966)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[](#php-based-command-line-key-listener)

This library provides an API to capture keys from the terminal. It currently supports latin-basic range of characters such as direction keys, function keys (F\*), enter, space, insert, delete, backspace, escape, a-z, etc.

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

[](#installation)

You can either download this library as a zip, or simply install it via composer:

```
composer require atatusoft-ltd/php-key-listener

```

Limitations
-----------

[](#limitations)

This package only works on UNIX/Linux based systems since the Windows PHP version doesn't not support the readline extension.

Example
-------

[](#example)

##### Capture all keys

[](#capture-all-keys)

```
use \Atatusoft\PhpKeyListener\Events\KeyPressEvent;
use \Atatusoft\PhpKeyListener\Environment\Detector;

$detect = new Detector();
$listener = $detect->getListenerInstance();

$eventDispatcher = $listener->getEventDispatcher();

$eventDispatcher->addListener('key:press', function(KeyPressEvent $event) {
    echo $event->getKey(), PHP_EOL;
});

$eventDispatcher->addListener('key:enter', function(KeyPressEvent $event) use ($eventDispatcher) {
    echo 'Key "', $event->getKey(), '" was pressed. Quitting listener.', PHP_EOL;

    // notify the listener to stop
    $eventDispatcher->dispatch('key:stop:listening');
});

$listener->start();
```

License
-------

[](#license)

Licensed under MIT.

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.1% 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

2

Last Release

1157d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b56f1a86c97a44aa8b6e391bdfff3e41895f2262f6fd9295195806a068921e23?d=identicon)[amasiye](/maintainers/amasiye)

---

Top Contributors

[![amasiye](https://avatars.githubusercontent.com/u/5607605?v=4)](https://github.com/amasiye "amasiye (8 commits)")[![iberflow](https://avatars.githubusercontent.com/u/402965?v=4)](https://github.com/iberflow "iberflow (6 commits)")

---

Tags

clikeyskeyboardkey press

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/atatusoft-ltd-php-key-listener/health.svg)

```
[![Health](https://phpackages.com/badges/atatusoft-ltd-php-key-listener/health.svg)](https://phpackages.com/packages/atatusoft-ltd-php-key-listener)
```

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.2k](/packages/symfony-console)[cilex/cilex

The PHP micro-framework for Command line tools based on the Symfony2 Components

6183.2M14](/packages/cilex-cilex)[n98/magerun

Tools for managing Magento projects and installations

1.4k264.7k7](/packages/n98-magerun)[n98/magerun2

Tools for managing Magento projects and installations

928244.3k6](/packages/n98-magerun2)[laminas/laminas-cli

Command-line interface for Laminas projects

563.7M54](/packages/laminas-laminas-cli)[duncan3dc/console

Create command line php applications using symfony/console

17263.4k1](/packages/duncan3dc-console)

PHPackages © 2026

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