ardillo/loop

ReactPHP Event Loop running on Ardillo

0.1.0 2023-08-29 23:44 UTC

This package is auto-updated.

Last update: 2024-05-17 00:12:58 UTC


README

CI Status Psalm Type Coverage Latest Stable Version Installs on Packagist Test Coverage Maintainability License

Ardillo Loop is an implementation of the ReactPHP Event Loop interface.

For documentation, please refer to the ReactPHP loop API reference: https://reactphp.org/event-loop/ as well as our examples: https://github.com/ardillo-php/examples

Note: Unlike the ReactPHP loop, Ardillo Loop cannot be restarted, i.e. once stopped, the implementing application is expected to prepare for termination. Given the nature of Ardillo applications (native desktop utilities), this should no be a limitation, however this can affect one's approach to unit testing.

This library also offers a ReactApp class which extends the base Ardillo App class in such fashion that the actual event loop management is abstracted away from the application logic. This allows for a more natural approach to writing Ardillo applications, where the application logic is not bound to the event loop implementation.

Installation

Before proceeding, make sure you have installed and enabled the Ardillo extension.

The recommended way to install Ardillo Loop is via Composer:

composer require ardillo/loop

Tests and Static Analysis

In order to run the tests, you need to clone the repository and install the dependencies via Composer:

git clone https://github.com/ardillo-php/loop.git
cd loop
composer install

You can then run the tests using the following command:

composer test

To run static analysis (PHPStan and Psalm), use the following commands:

composer phpstan
composer psalm

License

The MIT License (MIT). Please see LICENSE for more information.

Acknowledgments

This library extends the ReactPHP Event Loop and is inspired by the libuv loop implementation.

Contributing

Bug reports (and small patches) can be submitted via the issue tracker. Forking the repository and submitting a Pull Request is preferred for substantial patches. Please be sure to read and comply with the Contributing Terms document before proceeding.