2017 © Pedro Peláez
 

library future-process

Process execution for PHP using futures and promises

image

joshdifabio/future-process

Process execution for PHP using futures and promises

  • Saturday, May 16, 2015
  • by joshdifabio
  • Repository
  • 2 Watchers
  • 27 Stars
  • 34 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 5 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Future Process

Build Status Codecov Code Quality, (*1)

Introduction

Future Process is object-oriented proc_open with an asynchronous API and automatic queueing of commands., (*2)

Usage

// we use Shell to start new processes
$shell = new \FutureProcess\Shell;

// run a maximum of 5 concurrent processes - additional ones will be queued
$shell->setProcessLimit(5);

// let's download this package's license file from GitHub using wget
$url = 'https://raw.githubusercontent.com/joshdifabio/future-process/master/LICENSE';
$process = $shell->startProcess("wget -O - $url");

Non-blocking

We can consume the process output using promises., (*3)

// this will not block, even if the process is queued
$process->then(function ($process) {
    echo "Downloading file...\n";
});

// this will not block, even if the process is queued
$process->getResult()->then(function ($result) {
    echo "File contents:\n{$result->readFromPipe(1)}\n";
});

// this will block until all processes have exited
$shell->wait();

Blocking

We can also consume the process output synchronously., (*4)

// this will block until the process starts
$process->wait();
echo "Downloading file...\n";

// this will block until the process exits
echo "File contents:\n{$process->getResult()->readFromPipe(1)}\n";

Installation

Install Future Process using composer., (*5)

composer require joshdifabio/future-process

License

Future Process is released under the MIT license., (*6)

The Versions

16/05 2015

dev-react-stream

dev-react-stream

Process execution for PHP using futures and promises

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Di Fabio

process promise react child-process

15/05 2015

dev-master

9999999-dev

Process execution for PHP using futures and promises

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Di Fabio

process promise react child-process

06/04 2015

v0.2.0

0.2.0.0

Process execution for PHP using futures and promises

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Di Fabio

process promise react child-process

01/03 2015

v0.1.0

0.1.0.0

Process execution for PHP using futures and promises

  Sources   Download

MIT

The Requires

 

The Development Requires

by Josh Di Fabio

process promise react child-process