承接 cullylarson/local-commands 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cullylarson/local-commands

最新稳定版本:v1.0.6

Composer 安装命令:

composer require cullylarson/local-commands

包简介

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

README 文档

README

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.

Install

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

Usage

  1. Create an instance of Cully\Local\Command.

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

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

    <?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).

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

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

统计信息

  • 总下载量: 124
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-03