kisphp / php-sftp-client
Tiny PHP SFTP client
0.1.0
2021-10-06 06:55 UTC
Requires
- ext-ssh2: *
Requires (Dev)
- symfony/var-dumper: ~3.1
This package is not auto-updated.
Last update: 2024-11-13 19:35:33 UTC
README
Installation
Add in composer:
{ "require": { "kisphp/php-sftp-client": "~0.1" } }
Usage
Create a config class that implements ConfigInterface
<?php use Kisphp\ConfigInterface; class Config implements ConfigInterface { public function getHost() { return '10.10.0.61'; } public function getPort() { return 22; } public function getUsername() { return 'vagrant'; } public function getPassword() { return 'vagrant'; } }
Instantiate SftpConnect class and pass your Config object to it
$s = new SftpConnect(new Config());
Upload a file
$s->sendFile(__DIR__ . '/source.php', 'b.php'); // will return true for success and false for failure
Download a file
$s->receiveFile('a.php', 'c.php'); // will return true for success and false for failure