承接 dgvirtual/deploy-via-ftp 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

dgvirtual/deploy-via-ftp

Composer 安装命令:

composer require dgvirtual/deploy-via-ftp

包简介

Simple script package for deploying PHP projects to a shared hosting server via FTP or FTPS.

README 文档

README

This is a simple script package for deploying PHP projects to a shared hosting server via FTP or FTPS. It allows you to synchronize directories or upload individual files using lftp and curl.

Author

Name: Donatas Glodenis
Email: dg@lapas.info

Dependencies

This project has the following dependencies:

  • bash: Used to run the deployment script itself;
  • lftp: Used for synchronizing directories;
  • curl: Used for uploading individual files;
  • composer: Required for installing this package and updating the vendor directory before and after deployment.

Note: The project has been tested on Ubuntu 24.04 LTS.

Ensure that bash, lftp, curl, and composer are installed and accessible in your system's PATH.

Installation

You can install this package via Composer by running these commands at the root of your project:

composer require dgvirtual/deploy-via-ftp:dev-master

Note: although the project will not be used on the production server, it should be installed using composer require and not require-dev, as the app removes all dev-only packages before deploying vendor directory, and it should not remove itself.

This will install the deploy-via-ftp package from your GitHub repository and make the deployment script available in your project.

Then you will be able to run the deploy script via command:

./vendor/dgvirtual/deploy-via-ftp/src/deploy.sh [options]

You can also add an entry to your project's composer.json scripts section:

    "scripts": {
        "deploy": "./vendor/dgvirtual/deploy-via-ftp/src/deploy.sh"
    }

to be able to run the script more conveniently as

composer deploy [options]

Usage

Synchronizing Directories

You can use the following commands to synchronize directories with your remote FTP server:

composer deploy app
composer deploy vendor
composer deploy public
composer deploy public dry-run

You can also combine multiple directories in a single command:

composer deploy app vendor

Available Arguments

  • app: Synchronize the app directory only.
  • vendor: Synchronize the vendor directory only.
  • public: Synchronize the public_html directory only.
  • dry-run: Perform dry run (without changing content on the server).

Uploading a Single File

To upload a single file, use the following command:

composer deploy onefile [local_path]

Example:

composer deploy onefile app/Controllers/Test.php

This will upload app/Controllers/Test.php to the corresponding location on your FTP server. The remote path will be determined based on the local path.

Configuration

Before you can use the deployment script, you need to configure your FTP settings.

  1. On the first run, if the .ftp_config file is missing in the main project directory, the script will prompt you to create it by running an install.sh script.
  2. The install.sh script will:
    • Copy ftp-config.example to .ftp_config.
    • Optionally add .ftp_config to your .gitignore file.
    • Instruct you to edit .ftp_config with your FTP credentials.

Example .ftp_config:

# .ftp_config
USERNAME="myname"
PASSWORD="mySecretPass"
PROTOCOL="ftps"  # or "ftp"
PORT=21
SERVER="ftp.example.com"

# Remote directories
REMOTE_APP="/myproject/app"
REMOTE_VENDOR="/myproject/vendor"
REMOTE_PUBLIC_HTML="/public_html"

# Exclusion patterns
APP_EXCLUDE_GLOBS=""
VENDOR_EXCLUDE_GLOBS=""
PUBLIC_EXCLUDE_GLOBS="--exclude-glob='uploads/*' --exclude-glob='index.php'"

# Local directories
LOCAL_APP="app"
LOCAL_VENDOR="vendor"
LOCAL_PUBLIC_HTML="public"

Edit this file with your FTP credentials and paths as needed.

Notes

  • The script assumes that your project follows a structure where directories like app, vendor, and public_html are located in the base directory, while the server you deploy to places app and vendor inside myproject directory, which, along with public_html, is at the root of the directory structure accessible to ftp.
  • Make sure to review the exclusion patterns in the .ftp_config file and adjust them to suit your project.

If you have any issues or need further assistance, feel free to contact the author at dg@lapas.info.

This README.md file provides clear instructions for installing, configuring, and using the deploy-via-ftp script, tailored specifically for your needs.

dgvirtual/deploy-via-ftp 适用场景与选型建议

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-06