Class Symfony\Component\Process\ProcessBuilder

InheritanceSymfony\Component\Process\ProcessBuilder

Process builder.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor. Symfony\Component\Process\ProcessBuilder
add() Adds an unescaped argument to the command string. Symfony\Component\Process\ProcessBuilder
addEnvironmentVariables() Adds a set of environment variables. Symfony\Component\Process\ProcessBuilder
create() Creates a process builder instance. Symfony\Component\Process\ProcessBuilder
disableOutput() Disables fetching output and error output from the underlying process. Symfony\Component\Process\ProcessBuilder
enableOutput() Enables fetching output and error output from the underlying process. Symfony\Component\Process\ProcessBuilder
getProcess() Creates a Process instance and returns it. Symfony\Component\Process\ProcessBuilder
inheritEnvironmentVariables() Sets whether environment variables will be inherited or not. Symfony\Component\Process\ProcessBuilder
setArguments() Sets the arguments of the process. Symfony\Component\Process\ProcessBuilder
setEnv() Sets an environment variable. Symfony\Component\Process\ProcessBuilder
setInput() Sets the input of the process. Symfony\Component\Process\ProcessBuilder
setOption() Adds a proc_open option. Symfony\Component\Process\ProcessBuilder
setPrefix() Adds a prefix to the command string. Symfony\Component\Process\ProcessBuilder
setTimeout() Sets the process timeout. Symfony\Component\Process\ProcessBuilder
setWorkingDirectory() Sets the working directory. Symfony\Component\Process\ProcessBuilder

Method Details

__construct() public method

Constructor.

public void __construct ( array $arguments = [] )
$arguments string[]

An array of arguments

add() public method

Adds an unescaped argument to the command string.

public Symfony\Component\Process\ProcessBuilder add ( $argument )
$argument string

A command argument

addEnvironmentVariables() public method

Adds a set of environment variables.

Already existing environment variables with the same name will be overridden by the new values passed to this method. Pass null to unset a variable.

public Symfony\Component\Process\ProcessBuilder addEnvironmentVariables ( array $variables )
$variables array

The variables

create() public static method

Creates a process builder instance.

public static Symfony\Component\Process\ProcessBuilder create ( array $arguments = [] )
$arguments string[]

An array of arguments

disableOutput() public method

Disables fetching output and error output from the underlying process.

public Symfony\Component\Process\ProcessBuilder disableOutput ( )
enableOutput() public method

Enables fetching output and error output from the underlying process.

public Symfony\Component\Process\ProcessBuilder enableOutput ( )
getProcess() public method

Creates a Process instance and returns it.

public Symfony\Component\Process\Process getProcess ( )
throws Symfony\Component\Process\Exception\LogicException

In case no arguments have been provided

inheritEnvironmentVariables() public method

Sets whether environment variables will be inherited or not.

public Symfony\Component\Process\ProcessBuilder inheritEnvironmentVariables ( $inheritEnv true )
$inheritEnv bool
setArguments() public method

Sets the arguments of the process.

Arguments must not be escaped. Previous arguments are removed.

public Symfony\Component\Process\ProcessBuilder setArguments ( array $arguments )
$arguments string[]
setEnv() public method

Sets an environment variable.

Setting a variable overrides its previous value. Use null to unset a defined environment variable.

public Symfony\Component\Process\ProcessBuilder setEnv ( $name, $value )
$name string

The variable name

$value null|string

The variable value

setInput() public method

Sets the input of the process.

public Symfony\Component\Process\ProcessBuilder setInput ( $input )
$input resource|scalar|Traversable|null

The input content

throws Symfony\Component\Process\Exception\InvalidArgumentException

In case the argument is invalid

setOption() public method

Adds a proc_open option.

public Symfony\Component\Process\ProcessBuilder setOption ( $name, $value )
$name string

The option name

$value string

The option value

setPrefix() public method

Adds a prefix to the command string.

The prefix is preserved when resetting arguments.

public Symfony\Component\Process\ProcessBuilder setPrefix ( $prefix )
$prefix string|array

A command prefix or an array of command prefixes

setTimeout() public method

Sets the process timeout.

To disable the timeout, set this value to null.

public Symfony\Component\Process\ProcessBuilder setTimeout ( $timeout )
$timeout float|null
throws Symfony\Component\Process\Exception\InvalidArgumentException
setWorkingDirectory() public method

Sets the working directory.

public Symfony\Component\Process\ProcessBuilder setWorkingDirectory ( $cwd )
$cwd null|string

The working directory