zingle / zi-agent
Zingle infrastructure agent
Installs: 16 464
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^7.1
- phpseclib/phpseclib: ^2.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.4
- phpstan/phpstan: ^0.12.54
- phpunit/phpunit: ^8.5
- zingle-com/php-coding-standard: ^0.0.1
This package is auto-updated.
Last update: 2024-11-25 01:05:35 UTC
README
Installation
composer require zingle/zi-agent
Usage
use Zingle\Infrastructure\Agent; use Zingle\Infrastructure\Connection; $key = new \phpseclib\Crypt\RSA("-----BEGIN RSA PRIVATE KEY-----\nmTJJCjZ..."); $agent = new Agent("foo-user", $key); $connection = new Connection("example.com", $agent); $result = $connection->execute("my-command"); if ($result->getExit() !== 0) { echo $result->getOutput(); echo "failed\n"; } // if running multiple commands, explicitly open and close the connection $connection->open(); // ... $result = $connection->execute("..."); // ... $result = $connection->execute("..."); $connection->close();