juanchosl/ftpclient
Composer 安装命令:
composer require juanchosl/ftpclient
包简介
Little methods collection in order to create connections with file servers
README 文档
README
Description
Little methods collection in order to create connections to remote file servers
How to use
You needs to know the remote file server type connection in order to select the rigth instance
- Ftp
- Ftps over SSL
- Sftp over SSH
Instance
Direct instantiation
$connection = new Ftp();
Using a factory
$connection = EngineFactory::getInstance(EnginesEnum::FTP);
Connect
$connection->connect("ftp.servername.com", 21);
Authenticate
$connection->login("username", "password");
Authenticate with public key
For use public and private key over Sftp connection, set the credentials before login
$connection->setCredentials($absolute_path_to_publickey,$absolute_path_to_privatekey,$private_key_password);
Operate
You have a few generic methods and can operate over directories and files
Generic
| Method | Description |
|---|---|
| connect | Connect to a server |
| isConnected | Check if is connected |
| login | Login into server |
| disconnect | Disconnect from server |
| isLogged | Check if is logged |
| isDir | Check if is a dir |
| chmod | Change permissions |
| mode | Retrieve permissions |
| rename | Rename file or dir |
Directories
| Method | Description |
|---|---|
| listDirContents | For list the directory contents |
| listDirs | For list the directory subdirs |
| listFiles | For list the directory files |
| currentDir | The current directory path |
| createDir | For create a new directory |
| changeDir | For change to the selected directory |
| parentDir | For change to the parent directory |
| deleteDir | For remove a directory |
Files
| Method | Description |
|---|---|
| upload | For upload a file |
| write | For write contents into remote file |
| download | For download a file |
| read | For read contents from remote file |
| delete | For delete a file |
| filesize | For retrieve the filesize |
| lastModified | For retrieve the file last modification |
For FTP and FTPS
| Method | Description |
|---|---|
| pasive | true or false for apply pasive mode |
| system | The server operative system |
For SFTP
| Method | Description |
|---|---|
| getFingerprint | Retrieve and return the server fingerprint |
| getNegotiation | Retrieve and return the negotiation methods |
| setCredentials | Set public and private key for use on connection |
Adapters
You can use a wrapper in order to call the library functions using the native names from few OS
| Client | Linux | Windows | Description |
|---|---|---|---|
| chmod | chmod | icacls | Change permissions |
| mode | stat | cacls | Retrieve permissions |
| rename | mv | move | Rename file or dir |
| listDirContents | ls | dir | For list the directory contents |
| listDirs | lsDirs | dirDirs | For list the directory subdirs |
| listFiles | lsFiles | dirFiles | For list the directory files |
| currentDir | pwd | cd | The current directory path |
| createDir | mkdir | mkdir | For create a new directory |
| changeDir | cd | cd | For change to the selected directory |
| parentDir | cdUp | cdUp | For change to the parent directory |
| deleteDir | rm | rmdir | For remove a directory |
| upload | put | put | For upload a file |
| write | put | put | For write contents into remote file |
| download | get | get | For download a file |
| read | get | get | For read contents from remote file |
| delete | rm | del | For delete a file |
| filesize | filesize | filesize | For retrieve the filesize |
| lastModified | lastModified | lastModified | For retrieve the file last modification |
juanchosl/ftpclient 适用场景与选型建议
juanchosl/ftpclient 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 86 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 06 月 01 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sftp」 「ftp」 「file server」 「ftps」 「file transfer」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 juanchosl/ftpclient 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 juanchosl/ftpclient 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 juanchosl/ftpclient 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
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.
A remote FTP & S3 file manager using VueJS
A simple database backup manager for Symfony2 with support for S3, Rackspace, Dropbox, FTP, SFTP.
Laravel Media Popup to upload/view the files
统计信息
- 总下载量: 86
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-06-01