chemem / php-concurrently
A PHP version of concurrently built atop ReactPHP and RxPHP.
Requires
Requires (Dev)
Suggests
- ext-event: An interface to the event library written in C
- ext-uv: A high performance event-loop written in C
This package is auto-updated.
Last update: 2024-12-17 23:15:16 UTC
README
php-concurrently
A PHP version of concurrently written atop ReactPHP and RxPHP.
Requirements
- PHP 7.2 or higher
Rationale
Running multiple processes - especially those of the long-running variety - in distinct terminals is a practice that can become intractable, irrespective of Programming Language preferences. PHP, a language often derided for a lack of a rich assortment of programming artifacts, is despite the ill-conceived derision, an enabler of concurrency - via userspace tools like ReactPHP and RxPHP.
The impetus for creating and maintaining php-concurrently
is, therefore, a combination of strivings: a desire to harness existent language ecosystem tools to make running multiple processes concurrently - in a single terminal window - possible.
Installation
Though it is possible to clone the repo, Composer remains the best tool for installing php-concurrently
. To install the package via Composer, type the following in a console of your choosing.
$ composer global require chemem/php-concurrently
Basic Usage
php-concurrently
is a console application whose usage rubric follows a familiar concurrently [options] [arguments]
pattern. Shown below is a simple example to concurrently run two PHP processes - defined in the scipts
section of a composer.json
file - with php-concurrently
.
$ concurrently "composer server:run,composer worker:run"
It is possible to add to a composer.json
file - a php-concurrently
-executable directive - in a manner akin to defining concurrently
directives in package.json
files.
{ "scripts": { "app:run": "concurrently \"composer server:run, composer worker:run\"", "server:run": "php -f server.php 4000", "worker:run": "php -f worker.php" } }
Dealing with Problems
Endeavor to create an issue on GitHub when the need arises or send an email to lochbm@gmail.com.
Contributing
Consider buying me a coffee if you appreciate the offerings of the project and/or would like to provide more impetus for me to continue working on it.