artarts36/shell-command
最新稳定版本:2.1.15
Composer 安装命令:
composer require artarts36/shell-command
包简介
OOP ShellCommand
README 文档
README
Installation:
Run: composer require artarts36/shell-command
Examples:
1. Arguments && Options
use ArtARTs36\ShellCommand\ShellCommand; $command = ShellCommand::make('git')->addArgument('push')->addOption('force'); var_dump($command->__toString()); // git 'push' --force 2>&1
2. Execute Commands
use ArtARTs36\ShellCommand\ShellCommand; $command = ShellCommand::make('git')->addArgument('pull'); $result = $command->execute(); var_dump($result->getCommandLine()); var_dump($result->getCode()); var_dump($result->getDate()); var_dump($result->getResult()); var_dump($result->getError());
3. SSH
To use ssh, you need to connect the library "artarts36/shell-command-ssh-executor":
Run command artarts36/shell-command-ssh-executor
$connection = \ArtARTs36\ShellCommandSshExecutor\SSH\Connection::withPassword( 'remote.host', 'user', 'password' ); $command = \ArtARTs36\ShellCommand\ShellCommand::make('ls'); $command->setExecutor(new \ArtARTs36\ShellCommandSshExecutor\SshCommandExecutor($connection)); var_dump($command->getShellResult());
4. Mocking
$executor = new \ArtARTs36\ShellCommand\Executors\TestExecutor(); $command = new \ArtARTs36\ShellCommand\ShellCommand('reboot'); $executor->addSuccess('OK'); $command->execute($executor);
统计信息
- 总下载量: 2.02k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-06-25