kfoobar/laravel-file-transfer
最新稳定版本:v1.0.0
Composer 安装命令:
composer require kfoobar/laravel-file-transfer
包简介
FTP and SFTP file transfer classes for Laravel.
README 文档
README
A lightweight Laravel package for transferring files over FTP and SFTP. Wraps PHP's built-in FTP functions and phpseclib3 behind a unified interface.
Requirements
- PHP >= 7.3
- Laravel >= 7.0
Installation
composer require kfoobar/laravel-file-transfer
The service provider is registered automatically via Laravel's package auto-discovery.
Usage
FTP
use KFoobar\FileTransfer\Services\FTP; $ftp = new FTP( user: 'username', pass: 'password', host: 'ftp.example.com', port: 21, // optional, default: 21 ssl: false, // optional, default: false ); $ftp->connect(); // List files $files = $ftp->list('/remote/path'); // Download $ftp->download('/remote/path/file.txt', '/local/path/file.txt'); // Upload $ftp->upload('/local/path/file.txt', '/remote/path/file.txt'); // Delete $ftp->delete('/remote/path/file.txt'); $ftp->disconnect();
SFTP
use KFoobar\FileTransfer\Services\SFTP; $sftp = new SFTP( user: 'username', pass: 'password', host: 'sftp.example.com', port: 22, // optional, default: 22 ); $sftp->connect(); // List files $files = $sftp->list('/remote/path'); // Download $sftp->download('/remote/path/file.txt', '/local/path/file.txt'); // Upload $sftp->upload('/local/path/file.txt', '/remote/path/file.txt'); // Delete $sftp->delete('/remote/path/file.txt'); $sftp->disconnect();
Note: Named arguments in the examples above require PHP 8.0 or higher. On PHP 7.3–7.4, use positional arguments instead.
Contribution
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Make your changes and ensure tests pass.
- Submit a pull request with a detailed description of your changes.
License
This package is open-source and released under the MIT License. See LICENSE for more information.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-01