Documentation

ProcessBuilder
in package

Process builder.

Tags
author

Kris Wallsmith kris@symfony.com

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

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
$this

addEnvironmentVariables()

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
$this

create()

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
static

disableOutput()

Disables fetching output and error output from the underlying process.

public disableOutput() : $this
Return values
$this

enableOutput()

Enables fetching output and error output from the underlying process.

public enableOutput() : $this
Return values
$this

inheritEnvironmentVariables()

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
$this

setArguments()

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
$this

setEnv()

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
$this

setInput()

Sets the input of the process.

public setInput(resource|scalar|Traversable|null $input) : $this
Parameters
$input : resource|scalar|Traversable|null

The input content

Tags
throws
InvalidArgumentException

In case the argument is invalid

Return values
$this

setOption()

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
$this

setPrefix()

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
$this

setTimeout()

Sets the process timeout.

public setTimeout(float|null $timeout) : $this

To disable the timeout, set this value to null.

Parameters
$timeout : float|null
Tags
throws
InvalidArgumentException
Return values
$this

setWorkingDirectory()

Sets the working directory.

public setWorkingDirectory(null|string $cwd) : $this
Parameters
$cwd : null|string

The working directory

Return values
$this

        
On this page

Search results