定制 logifire/ftps-deploy 二次开发

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

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

logifire/ftps-deploy

Composer 安装命令:

composer require logifire/ftps-deploy

包简介

Simple FTPS deployment tool

README 文档

README

A simple PHP deployment tool that uses FTPS to upload changed files to a remote server. It tracks file changes using MD5 hashes and only uploads modified files.

Features

  • FTPS secure file transfer
  • Tracks file changes using MD5 hashes
  • Only uploads modified files
  • Supports file/directory ignore patterns
  • Creates remote directories automatically
  • Passive mode FTP support

Installation

Install via Composer:

composer require logifire/ftps-deploy

Configuration

You can initialize a template configuration file by running:

vendor/bin/deploy.php init

This will create a deploy-config.php file in your project root which you can then edit with your FTPS credentials.

Otherwise, create a deploy-config.php file manually in your project root:

<?php
return [
    // FTP connection settings
    'host' => 'example.com',
    'port' => 21,
    'username' => 'your-username',
    'password' => 'your-password',
    
    // Files/folders to ignore (supports wildcards)
    'ignore_patterns' => [
        '.git',
        '.gitignore',
        'node_modules',
        'vendor',
        '*.log',
        'tests'
    ]
];

Custom Configuration File Location

By default, FTPS deploy looks for deploy-config.php in the current working directory. If you want to use a configuration file located elsewhere, you can specify its path using the --config option:

vendor/bin/deploy.php --config=path/to/your/deploy-config.php

This allows you to keep multiple configuration files for different environments or projects, and select which one to use at deploy time.

Usage

Run deployment using:

vendor/bin/deploy.php

To only generate or update the hash file (without uploading or deleting any files), use the --only-hashes option:

vendor/bin/deploy.php --only-hashes

You can also specify a custom config file location with the --config argument:

vendor/bin/deploy.php --config=path/to/deploy-config.php

To see available options, run:

vendor/bin/deploy.php --help

Composer Script (Optional)

If you are using Composer, you can add a convenient script to your composer.json:

"scripts": {
    "deploy": "php vendor/bin/deploy.php",
    "deploy:staging": "php vendor/bin/deploy.php --config=deploy-config.staging.php"
}

This allows you to run deployment with:

composer deploy

Or, to deploy with a custom config file (e.g., for staging):

composer deploy:staging

Deployment Hashes File (deploy-hashes.json)

FTPS Deploy keeps track of file changes using a JSON file (by default named .deploy-hashes.json) in your project directory. This file stores hashes of previously deployed files to determine which files have changed and need to be uploaded or deleted.

  • Default location: .deploy-hashes.json in your project root.
  • Custom location: The hash_file entry is present by default in your deploy-config.php file. You can change its value to specify a different path:
'hash_file' => '/path/to/your-hashes.json',

This is useful if you want to:

  • Store deployment state outside your project directory (e.g., in CI/CD pipelines like GitHub Actions)
  • Use different hash files for different environments
  • Avoid committing the hash file to version control

Options

Option Description
init Create a template deploy-config.php in the current directory.
--config=PATH Use a custom config file instead of ./deploy-config.php.
--only-hashes Only generate/update the hash file, do not upload or delete files.
--help Show help message.

If you change the location, make sure the path is writable by the deployment process.

Requirements

  • PHP 8.0 or higher
  • PHP FTP extension
  • FTPS-enabled hosting

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Disclaimer: While FTPS Deploy automates the deployment process, it is the user's responsibility to verify that all files are correctly synchronized and that the deployment meets the intended requirements. Always review your deployment results and test your application after deploying.

Note: This library, including its code, documentation, and this README, was generated with the assistance of AI.

logifire/ftps-deploy 适用场景与选型建议

logifire/ftps-deploy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 23 次下载、GitHub Stars 达 2, 最近一次更新时间为 2025 年 04 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 logifire/ftps-deploy 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2025-04-28