zingle / zi-agent
Zingle基础设施代理
v2.0.0
2020-11-10 21:47 UTC
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-09-25 00:46:50 UTC
README
安装
composer require zingle/zi-agent
使用
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();