jzfpost / ssh2
PHP SSH2-client connection helper based on ext-ssh2
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:ssh2-helper
Requires
- php: >=8.1
- ext-mbstring: *
- ext-ssh2: *
- psr/log: *
Requires (Dev)
- jetbrains/phpstorm-attributes: dev-master
- phpunit/phpunit: ^9.5
- rector/rector: ^0.14.8
- roave/infection-static-analysis-plugin: ^1.16
- spatie/phpunit-watcher: ^1.23
- vimeo/psalm: ^4.18
This package is not auto-updated.
Last update: 2024-04-22 16:55:32 UTC
README
PHP SSH2-client connection helper based on ext-ssh2.
Example usage
$auth = new Password('username', 'password'); $conf = (new Configuration()) ->setTermType(TermTypeEnum::dumb); $ssh2 = new Ssh($conf, new RealtimeLogger()); $ssh2 = $ssh2->connect('192.168.1.1') ->authPassword('jzf', 'Ob$curite_25'); if (!$ssh->authenticate()) { throw new RuntimeException('Not authorised'); }; //open shell on network device $shell = $ssh2->getShell()->open(PromptEnum::cisco->value); $result = $shell->exec('show version'); // or exec on linux $exec = $ssh2->getExec(); $result = $exec->exec('ls -a'); $ssh2->disconnect();