laudirbispo/easy-ftp
Composer 安装命令:
composer require laudirbispo/easy-ftp
包简介
A simple FTP Client class
关键字:
README 文档
README
A simple Easy FTPClient class
I have always chosen to build simple classes and closer to the actual use. This class represents exactly that, simple and functional.
Installation
Install the latest version with
$ composer require laudirbispo/easy-ftp
Basic Usage
<?php use laudirbispo\EasyFTP\FTPClient; use laudirbispo\EasyFTP\Exceptions\{FTPException, NoConnection}; $FTP = new FTPClient(); $FTP->connect(string $host, int $port, int $timeout, bool $ssl); // or $FTP->sslConnection(string $host, int $port, int $timeout); $FTP->login(string $user, string $pass); /** * Turns on or off passive mode. * In passive mode, data connections are initiated by the client, rather than by the server. * @return bool */ $FTP->passiveModeOn(); $FTP->passiveModeOff(); /** * Get current directory * @return string|null */ $FTP->getCurrentDir(); /** * Moves to the specified directory * @return bool */ $FTP->goToDir($upUdir); /** * Back to the above directory * @return bool */ $FTP->backDir(); /** * Creates a new directory * @param $chmod octal - default is 0644 * @return bool */ $FTP->createDir(string $dir, 0755); /** * Move upload file * @param string $localFile * @param string $remoteFile * @param $chmod octal - default is 0644 * @return bool */ $FTP->upload(string $localFile, string $remoteFile, $chmod); /** * Download a file * @param string $remoteFile * @param string $localFile * @return bool */ $FTP->download(string $remoteFile, string $localFile); /** * Returns the file size * @param string $localFile * @return int - 0 if it does not exist or is not a file */ $FTP->getFileSize(string $remoteFile); /** * List directory * @param string $dir * @param bool $recursive * @return array */ $FTP->listDir(string $dir, bool $recursive); /** * Rename or move file or rename folder * @param string $oldName * @param string $newName * @return bool */ $FTP->rename(string $oldName, string $newName); /** * Move dir and files * @param string $oldName * @param string $newName * @return bool */ $FTP->move(string $oldLocal, string $newLocal); /** * Change chmod * @param string $path - file or dir * @param $chmod octal - default is 0644 * @param boll $recursive - aplly to subdirectories * @return bool */ $FTP->chmod(string $path, $chmod, bool $recursive); /** * Delete files and dirs * @param string $path - file or dir * @param boll $recursive - aplly to subdirectories * @return bool */ $FTP->delete(string $path, bool $recursive); /** * Get the timestamp of the last modification of the file * @param string $file- file * @return int timestamp */ $FTP->getLastModificationFile(string $file); /** * More * @return bool */ $FTP->isDir(string $directory); $FTP->isFile(string $file); /** * Send an arbitrary command to an FTP server * @param string $command * @return bool */ $FTP->command(string $command); // Example $FTP->command("MSG Wello Word"); /** * Send a message to server * @param string $message * @return bool */ $FTP->message(string $message); /** * Returns only the errors that occurred * @return array */ $FTP->getErrors(); /** * Checks for errors * @return bool */ $FTP->hasErrors(); /** * Returns a list formatted with everything that happened * @return html string formatted */ $FTP->debug(); // Debug example [02/05/2019 18:28:28] Status: Server connected by SSL [02/05/2019 18:28:28] Status: Passive mode activated [02/05/2019 18:28:28] Status: New directory "example", created [02/05/2019 18:28:28] Status: "example" chmod changed to "755" [02/05/2019 18:28:29] Status: "/example" deleted successfully [02/05/2019 18:28:29] Status: Command sent "MSG lorem ipsum dolor" executed [02/05/2019 18:28:29] Status: Message "Hello Word!" sent to server [02/05/2019 18:28:29] Status: Connection closed /** * Check if there is a connection * @return bool */ $FTP->hasConnection(); /** * End current connection */ $FTP->close(); /** * Recconect */ $FTP->reconnect();
Author
Laudir Bispo - laudirbispo@outlook.com - https://twitter.com/laudir_bispo
License
Easy FTPClient is licensed under the MIT License - see the LICENSE file for details
laudirbispo/easy-ftp 适用场景与选型建议
laudirbispo/easy-ftp 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 26 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 02 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ftp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 laudirbispo/easy-ftp 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 laudirbispo/easy-ftp 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 laudirbispo/easy-ftp 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
A remote FTP & S3 file manager using VueJS
A simple database backup manager for Symfony2 with support for S3, Rackspace, Dropbox, FTP, SFTP.
FTP client library
Simple deployment tool using git and FTP - especially useful for shared hosting.
Object oriented FTP client for PHP
统计信息
- 总下载量: 26
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-02-05