定制 gud3/executor 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

gud3/executor

Composer 安装命令:

composer require gud3/executor

包简介

This extension works with files both locally and remotely

README 文档

README

This extension works with files both locally and remotely. It can run commands in console mode. There are two different flags for execution with a response from the command and without (then the script will not wait for execution, an imitation of asynchronous execution). There are three public methods for working with the class: exec(), getFile(), setFile(). Each of the functions has a number of input parameters from which you can see below. To connect to the ssh2 in the constructor of the object, you need to transfer the data for the connection.

Installation

The preferred way to install this extension is through composer.

Enter run

php composer.phar require --prefer-dist gud3/executor "*"

or add

"gud3/executor": ">=1.0.0"

to the require section of your composer.json file.

Usage local

To execute the command locally in the system where the script is located:

$console = (new \gud3\executor\Local())->exec('command');

The variable in the console will be the result of executing the command line. For asynchronous execution (mostly used to run PHP or other scripts), you must pass the second parameter to true.

$console = (new \gud3\executor\Local())->exec('command', true);

Also, to execute a number of commands, you can pass an array to a function. And they are executed one after another.

$console = (new \gud3\executor\Local())->exec(['command1', 'command2']);

Usage Ssh2 protocol

To connect via the protocol, you must enter the IP address, login and password.

$connect = new \gud3\executor\Ssh2($ip, $login, $password, $port);
$console = $connect->exec(['command1', 'command2', 'command3']);

You can get the contents of the file as follows:

$local = new \gud3\executor\Local();
$file = $local->getFile($path_to_file, $file_name);

or remotely

$local = new \gud3\executor\Ssh2($ip, $login, $password, $port);
$file = $local->getFile($path_to_file, $file_name);

Overwrite the file if it exists. If the file does not exist then it will be created

$result = $local->setFile($path_to_file, $file_name, $content);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2017-07-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固