avv/sftp-flybridge

A robust bridge to connect to SFTP servers using Flysystem v3.

v1.0.0 2025-04-23 13:08 UTC

This package is auto-updated.

Last update: 2025-04-23 11:12:57 UTC


README

CI PHPStan

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.

Made with ❀️ by AVV