定制 jalsoedesign/filezilla 二次开发

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

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

jalsoedesign/filezilla

Composer 安装命令:

composer require jalsoedesign/filezilla

包简介

A powerful PHP library for parsing and working with FileZilla `sitemanager.xml` files. It allows you to extract server details, manage configurations, and integrate FileZilla data into your PHP applications.

README 文档

README

Latest Stable Version License

A powerful PHP library for parsing and working with FileZilla sitemanager.xml files. It allows you to extract server details, manage configurations, and integrate FileZilla data into your PHP applications.

Features

  • 🎉 Parse FileZilla sitemanager.xml files: Extract and work with server folders as well as individual server details.
  • 🔒 Stop using credentials in your code: If FileZilla already provides this unencrypted, and you're already using it, why not just read it from there?
  • Supports all FileZilla server attributes: Including host, port, protocol, and more.
  • 🔧 Flexible API: Query specific server details or all servers in a folder.
  • 📜 Enum-Based Design: Strongly typed enums for protocols, logon types, and more.
  • ⚙️ Works out of the box: The library defaults to the sitemanager.xml of your system. No need to specify a path.
  • 🚀 PHP 8.0+ Compatible: Built with modern PHP practices and strict typing.

Installation

Install the package via Composer:

composer require jalsoedesign/filezilla

Usage

Basic usage

Load the default sitemanager.xml from your system (using fromSystem()) and iterate through all servers and print their name.

use jalsoedesign\filezilla\SiteManager;

$siteManager = SiteManager::fromSystem();

$servers = $siteManager->getServers();

foreach ($servers as $server) {
    echo 'Full server path: ' . $server->getPath() . PHP_EOL;
}

Many other examples

See the examples folder.

Structure of sitemanager.xml

The test fixture tests/fixtures/sitemanager.xml provides an example of all possible options.

Folder structure of sitemanager.xml
📁 My Sites
│   📁 Protocols
│   ├── ☁️ azure-blob-storage.example.com
│   ├── ☁️ azure-file-storage.example.com
│   ├── ☁️ backblaze-b2.example.com
│   ├── ☁️ box.example.com
│   ├── ☁️ dropbox.example.com
│   ├── 🌐 ftp.example.com - explicit ftp over tls
│   ├── 🌐 ftp.example.com - explicit ftp over tls if available
│   ├── 🌐 ftp.example.com - implicit ftp over tls
│   ├── 🌐 ftp.example.com - plain ftp
│   ├── 🌐 google-cloudstorage.example.com
│   ├── ☁️ google-drive.example.com
│   ├── ☁️ onedrive.example.com
│   ├── ☁️ openstack-swift.example.com
│   ├── ☁️ rackspace-cloud-storage.example.com
│   ├── ☁️ s3.example.com
│   ├── 🌐 sftp.example.com
│   ├── 🌐 webdav.example.com - http
│   ├── 🌐 webdav.example.com - https
│   📁 Settings
│   │   📁 Advanced
│   │   ├── 🌐 _default
│   │   │   📁 Adjusted server time
│   │   │   ├── 🌐 minus 1 hour
│   │   │   ├── 🌐 plus 1 hour
│   │   │   ├── 🌐 plus 30 minutes
│   │   │   📁 Bypass proxy
│   │   │   ├── 🌐 disabled
│   │   │   ├── 🌐 enabled
│   │   │   📁 Directory comparison
│   │   │   ├── 🌐 disabled
│   │   │   ├── 🌐 enabled
│   │   │   📁 Local directory
│   │   │   ├── 🌐 local directory - Unix
│   │   │   ├── 🌐 local directory - Windows
│   │   │   📁 Remote directory
│   │   │   ├── 🌐 remote directory - Unix
│   │   │   ├── 🌐 remote directory - Windows
│   │   │   📁 Server type
│   │   │   ├── 🌐 cygwin
│   │   │   ├── 🌐 default
│   │   │   ├── 🌐 dos with back slashes
│   │   │   ├── 🌐 dos with forward slashes
│   │   │   ├── 🌐 doslike
│   │   │   ├── 🌐 hp nonstop
│   │   │   ├── 🌐 mvs
│   │   │   ├── 🌐 unix
│   │   │   ├── 🌐 vms
│   │   │   ├── 🌐 vxworks
│   │   │   ├── 🌐 zvm
│   │   │   📁 Synchronized browsing
│   │   │   ├── 🌐 disabled
│   │   │   ├── 🌐 enabled
│   │   📁 Charset
│   │   ├── 🌐 autodetect
│   │   ├── 🌐 custom charset - utf16
│   │   ├── 🌐 force utf8
│   │   📁 General
│   │   │   📁 Background color
│   │   │   ├── 🌐 none
│   │   │   ├── 🌐 red
│   │   │   📁 Comments
│   │   │   ├── 🌐 no comments
│   │   │   ├── 🌐 with comments
│   │   │   📁 Custom port
│   │   │   ├── 🌐 custom port 8080
│   │   │   ├── 🌐 default port
│   │   📁 Transfer Settings
│   │   ├── 🌐 transfer mode - 6 limit
│   │   ├── 🌐 transfer mode - Active
│   │   ├── 🌐 transfer mode - Default
│   │   ├── 🌐 transfer mode - No limit
│   │   ├── 🌐 transfer mode - Passive
│   📁 Various
│   ├── 🌐 Special !"#¤%&()=<>
│   ├── 🌐 Utf8 💞💢💫

Documentation

API Reference

Server

The Server class represents a single server configuration from the FileZilla sitemanager.xml file. It provides access to all attributes of a server, including its host, protocol, directories, and more.

Method Returns Description
getHost() string Get the server's hostname or IP address.
getPort() int Get the server's port number.
getProtocol() int Get the server's protocol (ServerProtocol enum).
getLogonType() int Get the server's logon type (LogonType enum).
getUser() ?string Get the username for authentication (nullable).
getPassword() ?string Get the password for authentication (nullable).
getKeyFile() ?string Get the path to the server's private key file (nullable).
getTimezoneOffset() ?int Get the server's timezone offset (nullable).
getPassiveMode() ?string Get the server's passive mode (PassiveMode enum, nullable).
getMaximumMultipleConnections() ?int Get the maximum concurrent connections (nullable).
getEncodingType() ?string Get the encoding type (CharsetEncoding enum, nullable).
getCustomEncoding() ?string Get the custom encoding if the encoding type is custom.
getBypassProxy() ?bool Check whether the server bypasses the proxy (nullable).
getType() int Get the server's type (ServerType enum).
getName() string Get the name of the server as it appears in FileZilla.
getComments() ?string Get the server's comments (nullable).
getLocalDirectory() ?string Get the initial local directory for the server (nullable).
getRemoteDirectory(string $default = null, bool $useRootPrefix = true) ?string Parse and return the server's remote directory (nullable).
getSynchronizedBrowsing() ?bool Check whether synchronized browsing is enabled (nullable).
getDirectoryComparison() ?bool Check whether directory comparison is enabled (nullable).
getColour() int Get the background color.
getColor() ?string Alias for getColour() (nullable).

Folder

The Folder class represents a collection of Server and/or Folder objects, allowing for recursive structures of servers and folders.

Method Returns Description
getName() string Get the name of the folder.
getChildren(bool $recursive, ?string $filter) Server[]/Folder[] Get all children in the folder, optionally recursive and filtered by type.
countServers(bool $recursive) int Count the number of servers in the folder, optionally including subfolders.
countFolders(bool $recursive) int Count the number of folders in the folder, optionally including subfolders.
getServers(bool $recursive) Server[] Get all servers in the folder, optionally including subfolders.
getFolders(bool $recursive) Folder[] Get all folders in the folder, optionally including subfolders.
getServer(string $serverPath) Server Get a specific server by its path.
getFolder(string $folderPath) Folder Get a specific folder by its path.
getChildPath(string $childName, ?string $childPath) string Construct a full path for a child within the folder.

SiteManager

The SiteManager class extends Folder, inheriting all of its functionality, and represents the root structure of FileZilla's server and folder configuration as defined in the sitemanager.xml file. In addition to managing nested folders and servers, it provides access to metadata about the configuration file itself.

Method Returns Description
SiteManager::fromSystem() SiteManager Create a SiteManager instance from the system's default configuration.
getVersion() string Get the version of the sitemanager.xml file.
getPlatform() string Get the platform specified in the sitemanager.xml file.

Enums

Enum Class Description
CharsetEncoding Charset encodings (Auto, UTF-8 or Custom)
Colour Background colours (e.g. Red, Green, Blue).
LogonType User authentication types (e.g., Normal, Anonymous).
PassiveType The PasvMode setting (MODE_DEFAULT, MODE_ACTIVE or MODE_PASSIVE)
ServerProtocol Server protocols like FTP, SFTP, FTPS, etc.
ServerType Server types like Unix, DOS, etc.

All enum classes have Enum::toCamelCase($value) as well as Enum::getConstantName($value) methods.

Filezilla config parsing

FileZilla Field Attribute Casting Note
Host host string Required
Port port int
Protocol protocol int
Type type int
User user string Required
Pass password string Required. Base64 encoded if encoding="base64"
Keyfile keyFile string Required
Colour colour int
Logontype logonType int
TimezoneOffset timezoneOffset int
PasvMode passiveMode string Required
MaximumMultipleConnections maximumMultipleConnections int
EncodingType encodingType string Required
BypassProxy bypassProxy bool
Name name string Required
Comments comments string Required
LocalDir localDirectory string Required
RemoteDir remoteDirectory string Required
SyncBrowsing synchronizedBrowsing bool
DirectoryComparison directoryComparison bool
CustomEncoding customEncoding string Required

Contributing

Contributions are welcome! Please submit a pull request or open an issue if you find a bug or have an idea for an enhancement.

License

This library is open-sourced under the MIT license.

Credits

Support

If you find this library useful, feel free to ⭐ the repository or share your feedback!

jalsoedesign/filezilla 适用场景与选型建议

jalsoedesign/filezilla 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 05 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 jalsoedesign/filezilla 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 jalsoedesign/filezilla 我们能提供哪些服务?
定制开发 / 二次开发

基于 jalsoedesign/filezilla 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-05-20