PHPackages                             mini4work/lib-io - 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. mini4work/lib-io

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

mini4work/lib-io
================

Package for FFI IO cross-platform calls. Can be used for mouse and keyboard manipulation.

0.3(1y ago)11MITPHPPHP ^8.3

Since Jan 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/mini4work/lib-io)[ Packagist](https://packagist.org/packages/mini4work/lib-io)[ RSS](/packages/mini4work-lib-io/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (0)

Mini4Work Lib IO
================

[](#mini4work-lib-io)

[![PHP](https://camo.githubusercontent.com/37b1036e1729dfed70410189f14514ee8c22a13a57f65bfa48ba2e705dca2e39/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e332d253233373737424234)](https://camo.githubusercontent.com/37b1036e1729dfed70410189f14514ee8c22a13a57f65bfa48ba2e705dca2e39/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545382e332d253233373737424234)

### A PHP package for mouse and keyboard manipulation using FFI.

[](#a-php-package-for-mouse-and-keyboard-manipulation-using-ffi)

> ⚠️ On first run, the system may request permission to control the keyboard or mouse. This is normal behavior, as these operations require special access for security reasons.

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

[](#requirements)

- **PHP 8.3** or higher
- **PHP FFI extension** (usually enabled by default)

### Enabling PHP FFI Extension

[](#enabling-php-ffi-extension)

- **Windows**: Uncomment the following line in your `php.ini` file to enable FFI: ```
    extension=php_ffi.dll
    ```
- **macOS**: If PHP is installed via **Homebrew**, FFI support is enabled by default.
- **Linux**: Check your `php.ini` file to ensure FFI is enabled.

Supported Platforms
-------------------

[](#supported-platforms)

**OS****PHP Version**macOS Sequoia8.3, 8.4Windows 118.4Installation
------------

[](#installation)

```
composer require mini4work/lib-io
```

Features
--------

[](#features)

### Mouse Control

[](#mouse-control)

**OS****Move****Click****GetPosition**macOS✅✅✅Linux (X11)⚠️⚠️⚠️Linux (WayLand)⏳⏳⏳Windows✅✅✅### Keyboard Control

[](#keyboard-control)

**OS****DownKey****UpKey****PressKey****IsKeyPressed**macOS✅✅✅✅Linux (X11)⚠️⚠️⚠️⚠️Linux (WayLand)⏳️⏳⏳️⏳Windows✅✅✅✅#### Legend

[](#legend)

**Symbol****Meaning**✅**Works and tested on real device** — The functionality works and has been tested on real devices (may still contain bugs on other devices).⚠️**Not tested** — Functionality is untested (consider it as *not supported*, but feel free to try it).⏳**In progress** — Functionality is under active development.Usage
-----

[](#usage)

### Mouse

[](#mouse)

Available methods:

```
use M4W\LibIO\Enums\MouseButton;
use M4W\LibIO\OSDetector;

$mouse = OSDetector::getMouseInstance();

$mouse->move(100, 200);

$mouse->click(MouseButton::Left, 100, 200);
$mouse->click(MouseButton::Right, 200, 200);

$position = $mouse->getPosition();
echo json_encode($position); // {"x":768.359375,"y":756.7109375}
```

### Keyboard

[](#keyboard)

Available methods:

```
use M4W\LibIO\Enums\KeyCode;
use M4W\LibIO\OSDetector;

$keyboard = OSDetector::getKeyboardInstance();

$keyboard->down(KeyCode::Space);
$keyboard->up(KeyCode::Space);

$keyboard->press(KeyCode::Backspace);

$isF4Pressed = $keyboard->isKeyPressed(KeyCode::F4); // boolean
```

Pressed key loop:

```
$isPressedState = [];

while (true) {
    foreach (KeyCode::cases() as $keyCode) {
        if (!array_key_exists($keyCode->name, $isPressedState)) {
            $isPressedState[$keyCode->name] = $keyboard->isKeyPressed($keyCode);
        }

        $isPressed = $keyboard->isKeyPressed($keyCode);
        if ($isPressedState[$keyCode->name] !== $isPressed) {
            $isPressedState[$keyCode->name] = $isPressed;
            echo ($isPressedState[$keyCode->name] ? 'Pressed key ' . $keyCode->name : 'Released key ' . $keyCode->name) . PHP_EOL;
        }
    }
    usleep(10000);
}
```

License
-------

[](#license)

Mini4Work is distributed under [The MIT license](https://opensource.org/licenses/MIT).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance41

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

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

Total

4

Last Release

491d ago

### Community

Maintainers

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

---

Top Contributors

[![mini4work](https://avatars.githubusercontent.com/u/194293655?v=4)](https://github.com/mini4work "mini4work (1 commits)")

### Embed Badge

![Health badge](/badges/mini4work-lib-io/health.svg)

```
[![Health](https://phpackages.com/badges/mini4work-lib-io/health.svg)](https://phpackages.com/packages/mini4work-lib-io)
```

PHPackages © 2026

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