avv / sftp-flybridge
A robust bridge to connect to SFTP servers using Flysystem v3.
Requires
- php: >=8.1
- league/flysystem-sftp-v3: ^3.0
Requires (Dev)
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^10.5
README
Effortlessly connect your PHP project with Flysystem SFTP using SFTP FLYBRIDGE. This package provides a seamless way to interact with remote SFTP servers, supporting both environment variables and manual configuration for maximum flexibility.
π Features
β
Simple Configuration β Use .env
or pass an array with credentials.
β
Secure & Fast β Built on Flysystem with best SFTP practices.
β
Flexible & Extensible β Supports custom root paths, ports, and timeouts.
β
PHP 8.1+ Compatibility β Modern, efficient, and optimized for performance.
π¦ Installation
Install via Composer:
composer require avv/sftp-flybridge
βοΈ Configuration
You can configure SFTP FLYBRIDGE using environment variables or by passing an array to the constructor.
πΉ Option 1: Using .env
I recommend add your SFTP credentials to the .env
file:
SFTP_HOST=sftp.example.com
SFTP_USERNAME=your_user
SFTP_PASSWORD=your_password
SFTP_PORT=22
SFTP_ROOT=/home/your_user/
SFTP_TIMEOUT=10
Then initialize the class:
use FlyBridge\SftpStorage;
$sftp = new SftpStorage();
πΉ Option 2: Passing Configuration Manually
$sftp = new SftpStorage([
'host' => 'sftp.example.com',
'username' => 'your_user',
'password' => 'your_password',
'port' => 22,
'root' => '/home/your_user/',
'timeout' => 10,
]);
π Usage Examples
Upload a File
$sftp->write('backup.sql', file_get_contents('local_backup.sql'));
Read a File
$content = $sftp->read('backup.sql');
echo $content;
Delete a File
$sftp->delete('backup.sql');
π§ͺ Testing
composer install
composer test
composer analyse
π€ Contributing
See CONTRIBUTING.md for guidelines.
π― Why Choose SFTP FLYBRIDGE?
π Easy Setup β Just install & configure!
π Secure β Uses Flysystemβs best SFTP practices.
β‘ Optimized β Lightweight and fast.
π License
MIT License. Free to use and modify.