2017 © Pedro Peláez
 

library local-commands

A library for executing local shell commands, with support for exit status, standard output, and error output.

image

cullylarson/local-commands

A library for executing local shell commands, with support for exit status, standard output, and error output.

  • Tuesday, September 15, 2015
  • by cullylarson
  • Repository
  • 1 Watchers
  • 0 Stars
  • 66 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Local Commands

A library for executing local shell commands, with support for exit status, standard output, and error output. The reason this exists is that there's a lot of boiler plate code necessary if you want to get stuff like error output from a command., (*1)

Install

curl -s http://getcomposer.org/installer | php
php composer.phar require cullylarson/local-commands

Usage

  1. Create an instance of Cully\Local\Command., (*2)

    <?php
    
    $command = new Cully\Local\Command();
    
  2. Execute your command., (*3)

    <?php
    
    $command->exec("ls");
    
  3. At this point, you have access to a few results:, (*4)

    <?php
    
    $command->success();       // whether the command succeeded
    $command->failure();       // whether the command failed
    $command->getCommand();    // the last command executed
    $command->getExitStatus(); // the exit status of the last command executed
    $command->getOutput();     // the standard output from the last command
    $command->getError();      // the error output from the last command
    

The exec Function

  1. $command (string) The command you want to execute (e.g. ls)., (*5)

  2. $cwd (string) (optional, default: null) The current working directory (the folder you want to execute the command in)., (*6)

  3. $env (array) (optional, default: []) An array of environment variable that you want to make available to the command., (*7)

The Versions

15/09 2015

dev-master

9999999-dev https://github.com/cullylarson/local-commands

A library for executing local shell commands, with support for exit status, standard output, and error output.

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

by Cully Larson

command-line shell

08/09 2015

v1.0.6

1.0.6.0 https://github.com/cullylarson/local-command

A library for executing local shell commands, with support for exit status, standard output, and error output.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cully Larson

command-line shell

08/09 2015

v1.0.5

1.0.5.0 https://github.com/cullylarson/local-command

A library for executing local shell commands, with support for exit status, standard output, and error output.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cully Larson

command-line shell

08/09 2015

v1.0.3

1.0.3.0 https://github.com/cullylarson/local-command

A library for executing local shell commands, with support for exit status, standard output, and error output.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cully Larson

command-line shell

08/09 2015

v1.0.4

1.0.4.0 https://github.com/cullylarson/local-command

A library for executing local shell commands, with support for exit status, standard output, and error output.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cully Larson

command-line shell

08/09 2015

v1.0.2

1.0.2.0 https://github.com/cullylarson/local-command

A library for executing local shell commands, with support for exit status, standard output, and error output.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cully Larson

command-line shell

03/09 2015

v1.0.1

1.0.1.0 https://github.com/cullylarson/local-command

A library for executing local shell commands, with support for exit status, standard output, and error output.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cully Larson

command-line shell

03/09 2015

v1.0.0

1.0.0.0 https://github.com/cullylarson/local-command

A library for executing local shell commands, with support for exit status, standard output, and error output.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cully Larson

command-line shell