laizware/quickshell

Quick wrapper for shell_exec to execute or run external commands from PHP that allows setting the working directory, environment variables and return the standard output.

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/laizware/quickshell

1.0.0 2023-11-07 20:07 UTC

This package is auto-updated.

Last update: 2025-12-08 00:46:45 UTC


README

Quick wrapper for shell_exec to execute or run external commands from PHP that allows setting the working directory, environment variables and return the standard output.

Installation

composer require laizware/quickshell

Example

<?php

use function LaizWare\Quickshell\run;

$command   = "ls";
$arguments = ["-l"];
$wd        = "/tmp/";
$env       = [
    "MY_ENVIRONMENT_X" => "X",
    "MY_ENVIRONMENT_Y" => "Y",
    "MY_ENVIRONMENT_Z" => "Z",
];

$stdout = run(
    // Required
    $command,

    // Optional
    $arguments,
    $env,
    $wd,
);