Flysystem is able to interact with FTP and SFTP servers using the same FilesystemOperator. To configure this bundle for such usage, you can rely on adapters in the same way you would for other storages.
composer require league/flysystem-ftp
# config/packages/flysystem.yaml
flysystem:
storages:
backup.storage:
ftp:
host: 'ftp.example.com'
username: 'username'
password: 'password'
port: 21
root: '/path/to/root'
passive: true
ssl: true
timeout: 30
ignore_passive_address: ~
utf8: falsecomposer require league/flysystem-sftp-v3
# config/packages/flysystem.yaml
flysystem:
storages:
backup.storage:
sftp:
host: 'example.com'
port: 22
username: 'username'
password: 'password'
privateKey: 'path/to/or/contents/of/privatekey'
passphrase: 'privatekey_passphrase'
hostFingerprint: 'host_fingerprint'
preferredAlgorithms:
hostkey: ['rsa-sha2-256', 'ssh-rsa']
root: '/path/to/root'
timeout: 10
directoryPerm: 0744
permPublic: 0700
permPrivate: 0744Using a lazy adapter to switch storage backend using an environment variable