2017 © Pedro Peláez
 

library process

Asynchronous process manager.

image

amphp/process

Asynchronous process manager.

  • Wednesday, July 25, 2018
  • by amphp
  • Repository
  • 9 Watchers
  • 54 Stars
  • 101,295 Installations
  • PHP
  • 13 Dependents
  • 0 Suggesters
  • 8 Forks
  • 4 Open issues
  • 25 Versions
  • 18 % Grown

The README.md

amphp/process

AMPHP is a collection of event-driven libraries for PHP designed with fibers and concurrency in mind. amphp/process provides an asynchronous process dispatcher that works on all major platforms (including Windows). It makes running child processes simple., (*1)

As Windows pipes are file handles and do not allow non-blocking access, this package makes use of a process wrapper, that provides access to these pipes via sockets. On Unix-like systems it uses the standard pipes, as these can be accessed without blocking there. Concurrency is managed by the Revolt event loop., (*2)

Latest Release MIT License, (*3)

Installation

This package can be installed as a Composer dependency., (*4)

composer require amphp/process

The package requires PHP 8.1 or later., (*5)

Usage

Processes are started with Process::start():, (*6)

<?php

require __DIR__ . "/vendor/autoload.php";

use Amp\ByteStream;
use Amp\Process\Process;

// "echo" is a shell internal command on Windows and doesn't work.
$command = DIRECTORY_SEPARATOR === "\\" ? "cmd /c echo Hello World!" : "echo 'Hello, world!'";

$process = Process::start($command);

Amp\async(fn () => Amp\ByteStream\pipe($process->getStdout(), ByteStream\getStdout()));
Amp\async(fn () => Amp\ByteStream\pipe($process->getStderr(), ByteStream\getStderr()));

$exitCode = $process->join();

echo "Process exited with {$exitCode}.\n";

Custom Working Directory

Processes are started with the working directory of the current process by default. The working directory can be customized to another directory if needed:, (*7)

$process = Amp\Process\Process::start($command, workingDirectory: '/path/of/your/dreams');

Custom Environment Variables

Processes are started with the environment variables of the current process by default. The environment can be customized by passing an associative array mapping variables names to their values:, (*8)

$process = Amp\Process\Process::start($command, environment: [
    'PATH' => '/usr/bin/local'
]);

Versioning

amphp/process follows the semver semantic versioning specification like all other amphp packages., (*9)

Security

If you discover any security related issues, please use the private security issue reporter instead of using the public issue tracker., (*10)

License

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

The Versions

25/07 2018

dev-ext-async

dev-ext-async https://github.com/amphp/process

Asynchronous process manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

09/04 2018

dev-master

9999999-dev https://github.com/amphp/process

Asynchronous process manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

08/04 2018

dev-windows-phar

dev-windows-phar https://github.com/amphp/process

Asynchronous process manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

08/04 2018

v0.3.3

0.3.3.0 https://github.com/amphp/process

Asynchronous process manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

08/03 2018

v0.3.2

0.3.2.0 https://github.com/amphp/process

Asynchronous process manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

01/02 2018

dev-windows-hang

dev-windows-hang https://github.com/amphp/process

Asynchronous process manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

10/12 2017

dev-windows

dev-windows https://github.com/amphp/process

Asynchronous process manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

05/12 2017

v0.3.1

0.3.1.0 https://github.com/amphp/process

Asynchronous process manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

25/11 2017

v0.3.0

0.3.0.0 https://github.com/amphp/process

Asynchronous process manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

10/10 2017

dev-spawn-close-fds

dev-spawn-close-fds https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

20/09 2017

dev-dave-windows

dev-dave-windows https://github.com/amphp/process

Asynchronous process manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

19/09 2017

dev-crash-on-windows-with-parallel

dev-crash-on-windows-with-parallel https://github.com/amphp/process

Asynchronous process manager.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

19/07 2017

dev-windows-stdio

dev-windows-stdio https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

18/07 2017

v0.2.1

0.2.1.0 https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

16/06 2017

v0.2.x-dev

0.2.9999999.9999999-dev https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

16/06 2017

v0.2.0

0.2.0.0 https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

21/03 2017

dev-amp_v2

dev-amp_v2 https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

10/03 2017

dev-read-pid-from-pipe

dev-read-pid-from-pipe https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

06/03 2017

dev-windows-fix

dev-windows-fix https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand
by Aaron Piotrowski

02/02 2017

v0.1.x-dev

0.1.9999999.9999999-dev https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand

24/09 2016

v0.1.3

0.1.3.0 https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand

24/12 2015

v0.1.2

0.1.2.0 https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

The Development Requires

by Bob Weinand

11/09 2015

dev-immediate_deferred

dev-immediate_deferred https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

by Bob Weinand

11/09 2015

v0.1.1

0.1.1.0 https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

by Bob Weinand

10/09 2015

v0.1.0

0.1.0.0 https://github.com/amphp/process

Asynchronous process manager

  Sources   Download

MIT

The Requires

 

by Bob Weinand