定制 kfoobar/laravel-file-transfer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Make your changes and ensure tests pass.
  4. 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
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-01