Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/norberttech/symfony-process-executor
💻 Symfony Process Component on steroids, async/sync execution chain.
https://github.com/norberttech/symfony-process-executor
execution parallel process symfony
Last synced: about 1 month ago
JSON representation
💻 Symfony Process Component on steroids, async/sync execution chain.
- Host: GitHub
- URL: https://github.com/norberttech/symfony-process-executor
- Owner: norberttech
- License: mit
- Created: 2020-04-23T09:31:27.000Z (over 4 years ago)
- Default Branch: 2.x
- Last Pushed: 2024-09-10T17:28:34.000Z (3 months ago)
- Last Synced: 2024-09-10T19:39:04.936Z (3 months ago)
- Topics: execution, parallel, process, symfony
- Language: PHP
- Homepage:
- Size: 6.47 MB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Symfony Process Executor
![Tests](https://github.com/norberttech/symfony-process-executor/workflows/Tests/badge.svg?branch=2.x)
Tiny library that simplifies launching multiple processes in parallel (or not).
### Installation
```bash
composer require norberttech/symfony-process-executor
```### Examples
```php
execute();$executor->waitForAllToFinish();
$executor->pool()->each(function (ProcessWrapper $processWrapper) {
var_dump($processWrapper->exitCode());
var_dump(\trim($processWrapper->output()));
var_dump($processWrapper->executionTime()->inSeconds());
var_dump($processWrapper->executionTime()->inMilliseconds());
var_dump($processWrapper->executionTime()->microsecond());
echo "----\n";
});echo \sprintf("Successfully finished child processes: %d\n", $executor->pool()->withSuccessExitCode());
echo \sprintf("Failure finished child processes: %d\n", $executor->pool()->withFailureExitCode());
echo \sprintf("Total execution time [s]: %d\n", $executor->executionTime()->inSecondsPreciseString());
```Output:
```bash
php examples/async_multiple_success_processes.phpint(0)
string(1) "1"
int(1)
int(1033)
int(1033295)
----
int(0)
string(1) "2"
int(2)
int(2064)
int(2064680)
----
int(0)
string(1) "3"
int(3)
int(3092)
int(3092137)
----
int(0)
string(1) "4"
int(4)
int(4026)
int(4026060)
----
int(0)
string(1) "5"
int(5)
int(5052)
int(5052531)
----
Successfully finished child processes: 5
Failure finished child processes: 0
Total execution time [s]: 5
```## Tests
All tests for this library are written as phpt files, you can read more about it here https://qa.php.net/phpt_details.php.
In order to launch full testsuite use composer
```php
composer tests
```