Download the PHP package tomcan/ssh-tasks without Composer

On this page you can find all versions of the php package tomcan/ssh-tasks. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ssh-tasks

PHP SSH Task executor

The PHP SSH Task executor (or ssh-tasks) is a library that allows you to execute commands/scripts over a remote SSH connection from PHP using the ssh2 extention.

Installation and usage

You can install the library through composer. Then include the autoloader as usual.

Authentication

You can authenticate to the remote server using several different authentication schemes. You can do this by passing an array of associative arrays with the the type key set to one of the options below.

none

Uses none authentication. Should hopefully not work, but it is supported. Although ssh_auth_none returns a list of supported authentication methods by the server, this value is not passed back or used by the library.

password

When using password authentication, the value of the password field in the array will be used as the password for ssh password authentication.

agent

When using agent authentication, PHP will try and use the users' ssh-agent active on the machine.

pubkey

When using the pubkey type, you need to specify both the public as private keys to use for authentication. You can do this by passing the respective paths using the pubkey and privkey keys in the array. If the private key file is protected with a passphrase, you can pass that passphrase using the passphrase key.

Using multiple authentication methods

You can add multiple elements to the authentication methods array. The library will try them in the order they appear in the array, and stops after the first successful method. Note that SSH servers will often close the connection when too many authentication attempts have been made.

Output

The library supports multiple ways of dealing with the output of the SSH command. You can control this by setting the outputMode parameter on the SshTask::execute() method. This parameters defaults to log.

Order of the output

When dealing with multiple output stream (stdout and stderr), the order in which they are read is not guaranteerd as you can't read both streams at exactly the same time. It is possible that output to stdout or stderr is processed in a different order than what the output of the command in an actual terminal would be. This is definitely the case when executing commands that output a lot of data on both streams at the same time.

log

When using the log the output mode, every successful read from either the stdout of stderr steam is added to an array where every element contains the timestamp, stream name, and actual data read.

split

When using the split output type, the output array will contain 2 elements. Element 0 will contain the concatenated output for stdout, where element 1 contains the concatenated output of stderr.

combined

When using the combined output type, the command is wrapped in a function with stderr redirected to stdout. It further functions in the same way as split, but will not have any output in the second element. Since the output redirection works on the server side, the stdout/stderr output typically always is in the correct order, but you can't tell apart stdout from stderr.

callback

When using the callback output type, you can specify a callback function instead of storing the output in an array. This allows you to receive the output while the command is still running, which can be useful for getting feedback from long running commands.
The function will be called using call_user_func and you can set a callback for the output and error stream.

Would result in:


All versions of ssh-tasks with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-ssh2 Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tomcan/ssh-tasks contains the following files

Loading the files please wait ....