league/flysystem-sftp
Deprecated since Flysystem 3.0; use flysystem-sftp-v3 instead. Provides an SFTP adapter for Flysystem using phpseclib2. This is a sub-split—issues and PRs belong in the main Flysystem repo. Install via composer require league/flysystem-sftp.
Strengths:
Storage facade (via league/flysystem-* adapters) or custom implementations using the Filesystem contract.filesystem::file-uploaded) for post-processing (e.g., notifications, backups).Weaknesses:
config/sftp.php out of the box). Custom configuration or packages like spatie/laravel-sftp may be needed.symfony/cache) or async processing (e.g., queues) may be necessary for high-throughput use cases.League\Flysystem\FilesystemInterface, so it can replace Laravel’s default Local or Cloud storage adapters.Illuminate\Contracts\Filesystem\Filesystem to the SFTP adapter)..env or config files.phpseclib/phpseclib (for SFTP) or paragonie/sodium (for SSH). May need vendor-specific PHP extensions (e.g., libssh2 for performance).phpseclib’s persistent connections) or a library like league/container to manage lifecycles..env for credentials, use Laravel’s Vault or Encryption services, and rotate keys regularly.Monolog).Mockery to stub the FilesystemInterface or integrate with a test container (e.g., Dockerized SFTP server for integration tests).Storage facade to use the SFTP adapter. Example:
// config/filesystems.php
'disks' => [
'sftp' => [
'driver' => 'league-flysystem',
'adapter' => \League\Flysystem\Sftp\SftpAdapter::class,
'options' => [
'host' => env('SFTP_HOST'),
'username' => env('SFTP_USERNAME'),
'password' => env('SFTP_PASSWORD'),
'port' => env('SFTP_PORT', 22),
'root' => env('SFTP_ROOT', '/'),
'timeout' => 30,
],
],
],
busy queue) to avoid timeouts.FileUploaded) to decouple file processing from storage logic.libssh2 for performance over pure PHP implementations (e.g., phpseclib).symfony/cache or Laravel’s cache to reduce SFTP calls for metadata operations (e.g., files()).Storage::disk('local') with Storage::disk('sftp') for specific use cases (e.g., uploads).rsync or custom scripts).phpseclib may need PHP 8.1+ for newer features).chmod, symlinks, large files).composer require league/flysystem-sftp phpseclib/phpseclib
.env and config/filesystems.php.SftpAdapter using Mockery.atmoz/sftp).phpseclib or league/flysystem updates may introduce breaking changes.composer.json or use platform.sh/Heroku for managed dependencies.Monolog handlers (e.g., `How can I help you explore Laravel packages today?