PHPackages                             phil-waters/process - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. phil-waters/process

ActiveLibrary[CLI &amp; Console](/categories/cli)

phil-waters/process
===================

Allows command line commands to be run asynchronously

0.4.0(9y ago)018MITPHP

Since Apr 10Pushed 9y ago1 watchersCompare

[ Source](https://github.com/PhilWaters/Process)[ Packagist](https://packagist.org/packages/phil-waters/process)[ RSS](/packages/phil-waters-process/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (5)Used By (0)

Process
=======

[](#process)

Process allows command line commands to be run asynchronously.

Usage
-----

[](#usage)

```
$process = new Process();

$waiter = $process
    ->cwd("/working/directory") // Set the working directory
    ->cmd("find")               // Set to command to run
    ->arg(".")                  // Add an argument
    ->option("-type", "f")      // Add an option and value
    ->log("/tmp/files.log")     // Set the location of the log file
    ->async()                   // Set the process to run asynchronously
    ->run();                    // Run the command

// do some other stuff

$waiter->wait(5);               // Wait for the process to complete with a timeout of 5 seconds

```

Process Methods
---------------

[](#process-methods)

### cwd

[](#cwd)

```
void PhilWaters\Process\Process::cwd(string $cwd)

```

Sets working directory

- Visibility: **public**

#### Arguments

[](#arguments)

- $cwd **string** - &lt;p&gt;Working directory&lt;/p&gt;

### cmd

[](#cmd)

```
\PhilWaters\Process\Process PhilWaters\Process\Process::cmd(string $cmd)

```

Sets the command to run

- Visibility: **public**

#### Arguments

[](#arguments-1)

- $cmd **string** - &lt;p&gt;Command to run&lt;/p&gt;

### option

[](#option)

```
\PhilWaters\Process\Process PhilWaters\Process\Process::option(string $option, string $value, string $separator)

```

Adds a command option

- Visibility: **public**

#### Arguments

[](#arguments-2)

- $option **string** - &lt;p&gt;Option&lt;/p&gt;
- $value **string** - &lt;p&gt;Value&lt;/p&gt;
- $separator **string** - &lt;p&gt;Separator&lt;/p&gt;

### arg

[](#arg)

```
\PhilWaters\Process\Process PhilWaters\Process\Process::arg(string $arg)

```

Adds an argument

- Visibility: **public**

#### Arguments

[](#arguments-3)

- $arg **string** - &lt;p&gt;Argument&lt;/p&gt;

### args

[](#args)

```
\PhilWaters\Process\Process PhilWaters\Process\Process::args($arg)

```

Adds arguments

- Visibility: **public**

#### Arguments

[](#arguments-4)

- $arg **mixed**

### async

[](#async)

```
\PhilWaters\Process\Process PhilWaters\Process\Process::async()

```

Configures the process to run asynchronously. The run method will return a waiter instead of the output.

- Visibility: **public**

### log

[](#log)

```
\PhilWaters\Process\Process PhilWaters\Process\Process::log(string $path, \PhilWaters\Process\number $mode)

```

Sets the path to a log file

- Visibility: **public**

#### Arguments

[](#arguments-5)

- $path **string** - &lt;p&gt;Log file path&lt;/p&gt;
- $mode **PhilWaters\\Process\\number** - &lt;p&gt;Log write mode (FILE\_APPEND)&lt;/p&gt;

### stdin

[](#stdin)

```
\PhilWaters\Process\Process PhilWaters\Process\Process::stdin(mixed $stdin, string $type)

```

Sets STDIN source (file or pipe)

- Visibility: **public**

#### Arguments

[](#arguments-6)

- $stdin **mixed** - &lt;p&gt;File path or value to pass to STDIN&lt;/p&gt;
- $type **string** - &lt;p&gt;file or pipe&lt;/p&gt;

### stdout

[](#stdout)

```
\PhilWaters\Process\Process PhilWaters\Process\Process::stdout(string $path, string $mode)

```

Sets STDOUT path

- Visibility: **public**

#### Arguments

[](#arguments-7)

- $path **string** - &lt;p&gt;File path&lt;/p&gt;
- $mode **string** - &lt;p&gt;Write mode (FILE\_APPEND)&lt;/p&gt;

### stderr

[](#stderr)

```
\PhilWaters\Process\Process PhilWaters\Process\Process::stderr(string $path, string $mode)

```

Sets STDERR path

- Visibility: **public**

#### Arguments

[](#arguments-8)

- $path **string** - &lt;p&gt;File path&lt;/p&gt;
- $mode **string** - &lt;p&gt;Write mode (FILE\_APPEND)&lt;/p&gt;

### env

[](#env)

```
\PhilWaters\Process\Process PhilWaters\Process\Process::env(array $env)

```

Sets array of environment variables

- Visibility: **public**

#### Arguments

[](#arguments-9)

- $env **array** - &lt;p&gt;Array of environment variables&lt;/p&gt;

### run

[](#run)

```
\PhilWaters\Process\Waiter|array PhilWaters\Process\Process::run()

```

Runs the command

- Visibility: **public**

### buildCommand

[](#buildcommand)

```
string PhilWaters\Process\Process::buildCommand()

```

Builds command string

- Visibility: **public**

Waiter Methods
--------------

[](#waiter-methods)

### wait

[](#wait)

```
boolean PhilWaters\Process\Waiter::wait(\PhilWaters\Process\number $timeout)

```

Wait for the process to finish

- Visibility: **public**

#### Arguments

[](#arguments-10)

- $timeout **PhilWaters\\Process\\number** - &lt;p&gt;Number of seconds to wait. Pass null to wait indefinitely or until PHP process exits based on max\_execution\_time&lt;/p&gt;

### terminate

[](#terminate)

```
void PhilWaters\Process\Waiter::terminate(integer $signal)

```

Terminates process

- Visibility: **public**

#### Arguments

[](#arguments-11)

- $signal **integer** - &lt;p&gt;Kill signal&lt;/p&gt;

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

4

Last Release

3311d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d6928ff756d9742ec4e5e3c9afff59c5cb58286dc0980ab0ad732d24adb9405a?d=identicon)[mwojtowicz](/maintainers/mwojtowicz)

---

Tags

asynchronousprocessbackgroundEscapeescaping

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phil-waters-process/health.svg)

```
[![Health](https://phpackages.com/badges/phil-waters-process/health.svg)](https://phpackages.com/packages/phil-waters-process)
```

###  Alternatives

[titasgailius/terminal

Terminal is an Elegent wrapper around Symfony's Process component.

512340.9k11](/packages/titasgailius-terminal)[misterion/ko-process

Simple pcntl fork wrapper and process manager

177337.7k6](/packages/misterion-ko-process)[vova07/yii2-console-runner-extension

An extension for running console commands on background in Yii framework.

88202.2k2](/packages/vova07-yii2-console-runner-extension)[winbox/args

Windows command-line formatter

21714.4k21](/packages/winbox-args)[ptlis/shell-command

A basic wrapper around execution of shell commands.

2256.0k2](/packages/ptlis-shell-command)[phlib/console-process

Console implementation.

1833.5k2](/packages/phlib-console-process)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
