rickmacgillis/sftp-and-ftp-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

rickmacgillis/sftp-and-ftp-client

Composer 安装命令:

composer require rickmacgillis/sftp-and-ftp-client

包简介

A flexible FTP, SSL-FTP, and SSH-based SFTP client for PHP. This lib provides helpers that are easy to use to manage the remote files.

README 文档

README

Originally forked from nicolab/php-ftp-client, this project now supports Windows FTP and SSH FTP connections by mashing it with phpseclib/phpseclib.

A flexible FTP and SSH-FTP client for PHP. This lib provides helpers easy to use to manage the remote files.

This package is aimed to remain simple and light. It's only a wrapper of the FTP native API of PHP, with some useful helpers. If you want to customize some methods, you can do this by inheriting one of the 3 classes of the package.

Install

  • Use composer: require rickmacgillis/php-ftp-client

  • Or use GIT clone command: git clone git@github.com:rickmacgillis/php-ftp-client.git

  • Or download the library, configure your autoloader or include the 3 files of php-ftp-client/src/FtpClient directory.

Getting Started

Connect to a server FTP :

$ftp = new FtpClient();
$ftp->setHost($host);
$ftp->setPass($pass);
$ftp->setUser($user);
$ftp->setPort($port); // Defaults to port 21 if not explicitly set.
$ftp->setPassiveMode($passiveMode); // Set to true. (Defaults to false/active mode.)
$ftp->setTimeout($timeoutSeconds);
$ftp->setUseSsh(false);

$ftp->connect();

OR

Connect to a server FTP via SSH (on port 22 or another port) :

$ftp = new FtpClient();
$ftp->setHost($host);
$ftp->setPass($pass);
$ftp->setUser($user);
$ftp->setPort($port); // Defaults to port 22 if not explicitly set.
$ftp->setTimeout($timeoutSeconds);
$ftp->setUseSsh(true);

Note: The connection is implicitly closed at the end of script execution (when the object is destroyed). Therefore it is unnecessary to call $ftp->close(), except for an explicit re-connection.

License

All code is released under the MIT license.

Credits

  1. PHPSecLib team for building the SFTP integration components.
  2. Nicolas Talle (nicolab) for the original FTP client code and inspiration for extending his package.
  3. Rick Mac Gillis (rickmacgillis) for merging the two codebases and providing a unified interface for easy use no matter which type of authentication you need for FTP.

TODO

  1. Add better test coverage.
  2. Add more documentation

统计信息

  • 总下载量: 3.36k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固