ProcessBuilder
in package
Process builder.
Tags
Table of Contents
Properties
- $arguments : mixed
- $cwd : mixed
- $env : mixed
- $inheritEnv : mixed
- $input : mixed
- $options : mixed
- $outputDisabled : mixed
- $prefix : mixed
- $timeout : mixed
Methods
- __construct() : mixed
- Constructor.
- add() : $this
- Adds an unescaped argument to the command string.
- addEnvironmentVariables() : $this
- Adds a set of environment variables.
- create() : static
- Creates a process builder instance.
- disableOutput() : $this
- Disables fetching output and error output from the underlying process.
- enableOutput() : $this
- Enables fetching output and error output from the underlying process.
- getProcess() : Process
- Creates a Process instance and returns it.
- inheritEnvironmentVariables() : $this
- Sets whether environment variables will be inherited or not.
- setArguments() : $this
- Sets the arguments of the process.
- setEnv() : $this
- Sets an environment variable.
- setInput() : $this
- Sets the input of the process.
- setOption() : $this
- Adds a proc_open option.
- setPrefix() : $this
- Adds a prefix to the command string.
- setTimeout() : $this
- Sets the process timeout.
- setWorkingDirectory() : $this
- Sets the working directory.
Properties
$arguments
private
mixed
$arguments
$cwd
private
mixed
$cwd
$env
private
mixed
$env
= array()
$inheritEnv
private
mixed
$inheritEnv
= true
$input
private
mixed
$input
$options
private
mixed
$options
$outputDisabled
private
mixed
$outputDisabled
= false
$prefix
private
mixed
$prefix
= array()
$timeout
private
mixed
$timeout
= 60
Methods
__construct()
Constructor.
public
__construct([array<string|int, string> $arguments = array() ]) : mixed
Parameters
- $arguments : array<string|int, string> = array()
-
An array of arguments
add()
Adds an unescaped argument to the command string.
public
add(string $argument) : $this
Parameters
- $argument : string
-
A command argument
Return values
$thisaddEnvironmentVariables()
Adds a set of environment variables.
public
addEnvironmentVariables(array<string|int, mixed> $variables) : $this
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.
Parameters
- $variables : array<string|int, mixed>
-
The variables
Return values
$thiscreate()
Creates a process builder instance.
public
static create([array<string|int, string> $arguments = array() ]) : static
Parameters
- $arguments : array<string|int, string> = array()
-
An array of arguments
Return values
staticdisableOutput()
Disables fetching output and error output from the underlying process.
public
disableOutput() : $this
Return values
$thisenableOutput()
Enables fetching output and error output from the underlying process.
public
enableOutput() : $this
Return values
$thisgetProcess()
Creates a Process instance and returns it.
public
getProcess() : Process
Tags
Return values
ProcessinheritEnvironmentVariables()
Sets whether environment variables will be inherited or not.
public
inheritEnvironmentVariables([bool $inheritEnv = true ]) : $this
since version 3.3, to be removed in 4.0.
Parameters
- $inheritEnv : bool = true
Return values
$thissetArguments()
Sets the arguments of the process.
public
setArguments(array<string|int, string> $arguments) : $this
Arguments must not be escaped. Previous arguments are removed.
Parameters
- $arguments : array<string|int, string>
Return values
$thissetEnv()
Sets an environment variable.
public
setEnv(string $name, null|string $value) : $this
Setting a variable overrides its previous value. Use null
to unset a
defined environment variable.
Parameters
- $name : string
-
The variable name
- $value : null|string
-
The variable value
Return values
$thissetInput()
Sets the input of the process.
public
setInput(resource|scalar|Traversable|null $input) : $this
Parameters
- $input : resource|scalar|Traversable|null
-
The input content
Tags
Return values
$thissetOption()
Adds a proc_open option.
public
setOption(string $name, string $value) : $this
since version 3.3, to be removed in 4.0.
Parameters
- $name : string
-
The option name
- $value : string
-
The option value
Return values
$thissetPrefix()
Adds a prefix to the command string.
public
setPrefix(string|array<string|int, mixed> $prefix) : $this
The prefix is preserved when resetting arguments.
Parameters
- $prefix : string|array<string|int, mixed>
-
A command prefix or an array of command prefixes
Return values
$thissetTimeout()
Sets the process timeout.
public
setTimeout(float|null $timeout) : $this
To disable the timeout, set this value to null.
Parameters
- $timeout : float|null
Tags
Return values
$thissetWorkingDirectory()
Sets the working directory.
public
setWorkingDirectory(null|string $cwd) : $this
Parameters
- $cwd : null|string
-
The working directory