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
-
Create an instance of
Cully\Local\Command.<?php $command = new Cully\Local\Command(); -
Execute your command.
<?php $command->exec("ls"); -
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
-
$command(string) The command you want to execute (e.g.ls). -
$cwd(string) (optional, default: null) The current working directory (the folder you want to execute the command in). -
$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
其他信息
- 授权协议: MIT
- 更新时间: 2015-09-03