abogdan/shelly

Shelly 是一个小型库,允许您使用PHP抽象化shell命令。

dev-master / 0.1.x-dev 2014-12-12 18:18 UTC

This package is not auto-updated.

Last update: 2024-09-24 09:25:36 UTC


README

Shelly 是一个小型库,允许您使用PHP抽象化shell命令。

版本

0.1.0

安装

您需要Composer来安装这个库

"require": {
        ...
        "abogdan/shelly": "dev-master",
        ...
    },
composer require abogdan/shelly:dev-master

示例

use ABogdan\Shelly\Command\CompositeCommand;
use ABogdan\Shelly\Command\SimpleCommand;
use ABogdan\Shelly\Builder;
use ABogdan\Shelly\Executor;
$seq = new \PhpCollection\Sequence();

//simple example
$cat = new SimpleCommand('cat', [__FILE__]);
$executor = new Executor(new Builder());
$output = $executor->execute($cat);

//composite example
$find = new SimpleCommand('find', ['./tests/', '-name', 'Command*'], true);
$cat = new SimpleCommand('cat');
$grep = new SimpleCommand('grep', ['-r', PHP_EOL]);
$seq->add($find);
$seq->add($cat);
$seq->add($grep);
$output = $executor->execute($complex);

待办事项

  • Windows 支持
  • 更好的错误处理
  • 更好的二进制/可执行文件查找器
  • 更好的构建策略
  • ...

许可证

MIT