Download the PHP package justmisha/php-multirunner without Composer

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

PHP MultiRunner

A package for running multiple processes in parallel in the background and, if necessary, get the results of their work.

It is clear that, first of all, such parallel execution allows you to radically reduce the time of all these processes.

This package:

Under the hood, it uses proc_open() to start processes and hides numerous complexities and peculiarities of working with processes in PHP.

It does not require any other packages or extensions to be installed.

Usage

Run a single PHP script many times with different parameters and get its output messages.

General description of the interface

Six different classes can be used depending on the objects that are launched for execution:

  1. ProgramMultiRunner to run several instances of one program;
  2. DiffProgramMultiRunner to run miscellaneous programs;
  3. ScriptMultiRunner to run several instances of one script;
  4. DiffScriptMultiRunner to run different scripts (and/or even different interpreters);
  5. CodeMultiRunner to run any code created in your program;
  6. DiffCodeMultiRunner to run different code (possibly for different interpreters) created in your program.

The signature of the constructors of all these classes and their addProcess() method will naturally be different.

In any case, the first parameter of the constructor will always be the number of concurrent parallel processes that can be launched. This number depends entirely on the machine on which the package is running, that's why it is the first parameter and has no default value

Explicit is better than implicit. --- The Zen of Python

A good starting point would be 512 simultaneous parallel processes.

And then there are three possible use cases:

  1. Run and get the results of all running processes — ;
  2. Run and forget (do nothing) — ;
  3. Run and get the first N results — .

Data Exchange Between Parent and Child Processes

The package uses the following data exchange scheme between parent code and child processes:

  1. One-time data transfer in the form of parameters when a child process is added;
  2. Receiving data from child processes from their standard output streams (stdout) and error output (stderr).

There is no data exchange between the parent process and running child processes after they are started.

To ensure that data other than plain text is properly transferred from a child process, it must be properly encoded: serialization, json representation, base64 conversion or other means of representing the data.

Limitations

It is not intended to use output redirection when starting processes because.

  1. It may interfere with the established method of retrieving data from child processes;
  2. It will not work on Windows because when the proc_open() function is called, the bypass_shell option is set to true and the process is started bypassing the cmd.exe shell.

Dependency inversion during dependency injection

If you need to pass some child class as a parameter to a constructor or other method, it is worth using the interface to remove the dependency on a particular class.

More examples

Run one program many times with different parameters and get its messages about the results of its work

Run one program many times with different parameters and do nothing else (run and forget)

Run a single PHP script many times with different parameters and get its output messages

Run one PHP script many times with different parameters and get only a certain number of messages about the results (do not wait for all running processes to execute)

Run one Python script many times with different parameters and get its output messages

Run one PHP script many times with different parameters and do nothing (run and forget).

Run different scripts with different parameters and get his messages about the results of the work

Run different scripts with different parameters and do nothing (run and forget)

Run the PHP code many times with different parameters and get its output messages

Run the PHP code many times with different parameters and do nothing (run and forget)

Run PHP, python, and node.js code with different parameters and get its output messages

Run PHP, python, and node.js code with different parameters and do nothing (run and forget)

Installation

You will need:

For use in your project

For development

In the local project folder, execute

Testing

Run all tests, including linters and static analyzers, from the root of the project folder:

To run only unit tests:

The package was developed in Windows, so to run the tests in Linux via Docker you can use the command file, which will run the unit tests in Docker containers with php-cli 7.4, 8.0, 8.1, 8.2, 8.3. Or you can run a run tests for each php version using a different file (e.g. ).

The tests use the python and node.js interpreters. If you don't have them installed, then run the tests with the command line option or use the configuration file configuration file.

Safety and Security

Actions performed by processes executing this package may cause damage to the environment in which they are running and/or to user data.

The escaping of arguments that the package does is only to ensure that they are correctly passed to the process, and does not protect against malicious use.

Please be careful about what programs, scripts, or code you run and what arguments you pass to them to make sure they do not cause damage.

Contributing

Please send your suggestions, comments, and pull requests.

For large changes, please open a discussion to discuss your suggestions.

For pull requests, please make appropriate changes to the tests.

Versioning

We use SemVer for versioning.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.


All versions of php-multirunner with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
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 justmisha/php-multirunner contains the following files

Loading the files please wait ....