I guess there seems to be an issue with this "plugin", so I've removed it and tried "idct/sftp-client" instead, which works without any problems and fairly easy to use.
Using league's SFTP adapter with Flysystem
I've installed league's SFTP adapter for Flysystem.
I need to SFTP to a server to grab a file. Doing a test I can connect successfully, but when I call listContents() it returns null. For testing, I let it default to the user's home directory and it does contain files, so I should be getting files listed. Why would it return null?
Here is my test code. I've created a dummy function that I can run in tinker: (hiding IP, user and password for obvious reasons)
// Use
use League\Flysystem\Filesystem;
use League\Flysystem\Sftp\SftpAdapter;
// Function body
$adapter = new SftpAdapter([
'host' => 'x.x.x.x',
'port' => 22,
'username' => 'xxx',
'password' => 'xxx',
'timeout' => 10,
]);
$filesystem = new Filesystem($adapter);
$adapter->connect();
if ($adapter->isConnected()) {
echo "connected\r\n";
}
$ls = $filesystem->listContents('Desktop');
The user folder has a folder called Desktop, which has a couple of files. So when listContents() is called, it should be showing these files. It returns null instead.
Please or to participate in this conversation.