Download the PHP package detain/sshpool without Composer

On this page you can find all versions of the php package detain/sshpool. 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 sshpool

sshpool

License: GPL v3

detain/sshpool is a small PHP library for running many shell commands on a single SSH host concurrently. It maintains one SSH session, opens multiple ssh2_exec channels in parallel up to a configurable cap, collects each command's stdout / stderr / exit status, and fires a per-command callback on completion. Commands can be queued while the pool is already running, automatic retries with a back-off delay are supported, and per-command timeouts kill long-running work.

Requirements

Password authentication is not currently wired through; the supported path is public/private key authentication via ssh2_auth_pubkey_file.

Installation

If you do not already have ext-ssh2 installed:

Quick Start

Usage Patterns

One-shot synchronous command

For a single command where you want a synchronous result rather than a callback, use runCommand():

runCommand() returns false if the channel cannot be opened.

Adding commands while the pool is running

addCommand() is safe to call from inside a completion callback. New commands join $cmdQueue and the run loop picks them up on its next iteration.

Non-blocking single iteration

run(true) performs one polling iteration (start any newly-available commands, drain finished output, promote any due retries) and returns. This is useful when you want to integrate the pool into your own event loop.

Custom SSH connection methods

ssh2_connect() accepts an algorithm/method override array. Since B025 the default already supplies the shared RelayHostKeyPolicy::HOSTKEY_ALGORITHMS allowlist (rsa-sha2-512/256 first, ssh-rsa only as legacy fallback) and every connection is fingerprint-verified before auth. Pass the seventh constructor argument only to deliberately override that — e.g. pinning a single algorithm against a legacy server; a caller-supplied hostkey value wins over the default:

Configuration

Setter Default Effect
setMaxThreads(int) 50 Maximum number of channels open concurrently. Clamped to >= 1.
setMaxRetries(int) 0 Retry attempts on a non-zero exit status (or undersized output). 0 disables retry.
setWaitRetry(int) 15 Seconds to wait before promoting a retry back into the run queue.
setMinConfigSize(int) 0 Minimum stdout byte count required to consider a command successful. 0 disables.
$pollInterval (public int) 25000 Microseconds between run-loop polls in blocking mode.

Public API

Callback signature

Retry Semantics

A command is considered failed (and eligible for retry) when either:

Failed commands are deferred for waitRetry seconds, then promoted back into the run queue. The original timeout is preserved across retries. After maxRetries attempts the completion callback is invoked with the most recent exit status.

Timeouts

When addCommand($cmd, ..., $timeout) is given a non-zero $timeout, the run loop closes the command's streams once time() - start_time > $timeout. The callback is invoked just like any other completion. If a real exit status was not yet observed, the command is reported with exitStatus = -1.

The metadata property captures the actual duration and a boolean timed_out flag per id:

Development

The tests use a FakeSshPool fixture (tests/Fixtures/FakeSshPool.php) that bypasses ext-ssh2 so the queue / callback / retry logic is verified without needing a live SSH server.

License

GPL-3.0. See LICENSE.

Author

Joe Huss · [email protected]


All versions of sshpool with dependencies

PHP Build Version
Package Version
Requires 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 detain/sshpool contains the following files

Loading the files please wait ...