azjezz/psl
PSL is a modern, well-typed standard library for PHP 8.4+, inspired by HHVM’s HSL. It offers safer, predictable APIs for async, collections, networking, I/O, crypto, terminal UI, and robust data validation—replacing brittle built-ins with consistent alternatives.
The Process component provides a typed, non-blocking API for spawning and managing child processes, built on top of PSL's IO system.
It serves as an alternative to proc_*, symfony/process, and amphp/process, with an API inspired by Rust's std::process module adapted to PSL conventions.
@example('io/process-output.php')
Command is an immutable builder. All with*() methods return a new instance.
Command::create(string $program) -- executes a program directly, bypassing the shell. Prevents shell injection and is the recommended approach.Command::shell(string $command) -- interpreted by the system shell (/bin/sh -c on Unix, cmd.exe on Windows). Allows pipes, globbing, and variable expansion.Stdio controls what happens with each standard I/O stream:
Stdio::piped() -- pipe between parent and child (default for stdout/stderr)Stdio::inherit() -- child inherits the parent's descriptorStdio::null() -- attach to /dev/null (default for stdin)Stdio::tty() -- connect directly to the terminal, useful for interactive programs (Unix only)Stdio::fromStreamHandle($handle) -- use an existing stream handle@example('io/process-collect-output.php')
@example('io/process-exit-status.php')
@example('io/process-stdin.php')
@example('io/process-shell.php')
@example('io/process-timeout.php')
@example('io/process-signals.php')
@example('io/process-environment.php')
@example('io/process-poll.php')
See src/Psl/Process/ for the full API.
How can I help you explore Laravel packages today?