Process
in package
System Process
Table of Contents
Properties
- $error : mixed
- Last error message
Methods
- create() : object
- Create process
- findPhp() : string
- Get php executable
- getCommand() : string
- Get process command
- getCurrentPid() : mixed
- Get curret process pid
- getCurrentUser() : string
- Get current script user
- getLastError() : string|null
- Get last error
- isRunning() : bool
- Reurn true if process is running (Linux only)
- run() : mixed
- Run console command
- runComposerCommand() : mixed
- Run composer command
- runShellCommand() : mixed
- Run shell command
- setTitle() : void
- Set process title
- start() : mixed
- Run console command
- startBackground() : mixed
- Run console command in backgorund
- stop() : bool
- Stop (kill) process
- verifyProcess() : bool
- Return false if process not exist
Properties
$error
Last error message
private
static mixed
$error
= null
@var string|null
Methods
create()
Create process
public
static create(array<string|int, mixed>|string $command[, array<string|int, mixed> $env = null ][, string $input = null ][, int $timeout = 60 ][, array<string|int, mixed>|null $options = null ]) : object
Parameters
- $command : array<string|int, mixed>|string
- $env : array<string|int, mixed> = null
- $input : string = null
- $timeout : int = 60
- $options : array<string|int, mixed>|null = null
Return values
objectfindPhp()
Get php executable
public
static findPhp() : string
Return values
stringgetCommand()
Get process command
public
static getCommand(int $pid) : string
Parameters
- $pid : int
Return values
stringgetCurrentPid()
Get curret process pid
public
static getCurrentPid() : mixed
getCurrentUser()
Get current script user
public
static getCurrentUser() : string
Return values
stringgetLastError()
Get last error
public
static getLastError() : string|null
Return values
string|nullisRunning()
Reurn true if process is running (Linux only)
public
static isRunning(int $pid) : bool
Parameters
- $pid : int
Return values
boolrun()
Run console command
public
static run(string|array<string|int, mixed> $command[, array<string|int, mixed> $env = [] ][, bool $inheritEnv = true ]) : mixed
Parameters
- $command : string|array<string|int, mixed>
- $env : array<string|int, mixed> = []
- $inheritEnv : bool = true
runComposerCommand()
Run composer command
public
static runComposerCommand(string $command[, bool $async = false ][, bool $realTimeOutput = false ]) : mixed
Parameters
- $command : string
- $async : bool = false
- $realTimeOutput : bool = false
runShellCommand()
Run shell command
public
static runShellCommand(string $command[, string|null $cwd = null ][, array<string|int, mixed>|null $env = null ]) : mixed
Parameters
- $command : string
- $cwd : string|null = null
- $env : array<string|int, mixed>|null = null
setTitle()
Set process title
public
static setTitle(string $title) : void
Parameters
- $title : string
start()
Run console command
public
static start(array<string|int, mixed>|string $command[, callable|null $callback = null ][, array<string|int, mixed>|null $env = null ]) : mixed
Parameters
- $command : array<string|int, mixed>|string
- $callback : callable|null = null
- $env : array<string|int, mixed>|null = null
startBackground()
Run console command in backgorund
public
static startBackground(array<string|int, mixed>|string $command[, callable|null $callback = null ][, array<string|int, mixed> $env = [] ]) : mixed
Parameters
- $command : array<string|int, mixed>|string
- $callback : callable|null = null
- $env : array<string|int, mixed> = []
stop()
Stop (kill) process
public
static stop(string|int $pid) : bool
Parameters
- $pid : string|int
Return values
boolverifyProcess()
Return false if process not exist
public
static verifyProcess(int $pid) : bool
Parameters
- $pid : int