Open pedrolopes10 opened 6 years ago
You have to register the driver in Laravel Storage provider at App Boot, e. g. in Boot Method of AppServiceProvider
. After Driver registration you can use the driver in your filesytem.phh config file.
Code not tested
filesystem.php
'yourFilesystemAlias' => [
'driver' => 'sftp',
]
Register sftp driver:
Storage::extend('sftp', function ($app, $config) {
$adapter = new SftpAdapter([
'host' => 'example.com',
'port' => 22,
'username' => 'username',
'password' => 'password',
'privateKey' => 'path/to/or/contents/of/privatekey',
'root' => '/path/to/root',
'timeout' => 10,
'directoryPerm' => 0755
]);
return new Filesystem($adapter);
});
I've elfinder working with SFTP using it on elfinder.php config file as root:
'filesystem' => new Filesystem(new SftpAdapter([
But now it fails parsing bootstrap/cache/config.php when doing php artisan config:cache and i can't configure to use 'sftp' defined on filesystem.php config file.