sansanlabs/laravel-git-ftp-deployer
Composer 安装命令:
composer require sansanlabs/laravel-git-ftp-deployer
包简介
Laravel Git-FTP deployment package with git status checking and build integration
README 文档
README
A Laravel package for deploying applications via FTP with git status checking and build process integration.
Features
- ✅ Check git status before deployment
- ✅ Prevent deployment with uncommitted changes
- ✅ Prevent deployment with unpushed commits
- ✅ Run build commands (npm, yarn, etc.) before deployment
- ✅ Support multiple environments (staging, production)
- ✅ Beautiful tree view for uncommitted changes
- ✅ Cross-platform support (Windows, Linux, macOS)
- ✅ Configurable git-ftp options
Requirements
- PHP ^8.2
- Laravel ^10.0|^11.0|^12.0
- git-ftp installed on your system
Installation
You can install the package via composer:
composer require sansanlabs/laravel-git-ftp-deployer
You can publish the config file with:
php artisan vendor:publish --tag="git-ftp-deployer-config"
This is the contents of the published config file:
return [ /* |-------------------------------------------------------------------------- | Git-FTP Deploy Configuration |-------------------------------------------------------------------------- | | Configuration for Git-FTP deployment package | */ "environments" => [ "staging" => [ "host" => env("STAGING_FTP_HOST"), "username" => env("STAGING_FTP_USERNAME"), "password" => env("STAGING_FTP_PASSWORD"), "path" => env("STAGING_FTP_PATH", "/website/"), ], "production" => [ "host" => env("PRODUCTION_FTP_HOST"), "username" => env("PRODUCTION_FTP_USERNAME"), "password" => env("PRODUCTION_FTP_PASSWORD"), "path" => env("PRODUCTION_FTP_PATH", "/website/"), ], ], /* |-------------------------------------------------------------------------- | Build Command |-------------------------------------------------------------------------- | | The command to run before deployment | */ "build_command" => env("GIT_FTP_BUILD_COMMAND", "npm run build"), /* |-------------------------------------------------------------------------- | Git Bash Path |-------------------------------------------------------------------------- | | Path to Git Bash executable (default on Windows) | */ "git_bash_path" => env("GIT_BASH_PATH", "C:\\Program Files\\Git\\bin\\bash.exe"), /* |-------------------------------------------------------------------------- | Git-FTP Options |-------------------------------------------------------------------------- | | Additional options for git-ftp command | */ "git_ftp_options" => [ "force" => env("GIT_FTP_FORCE", true), "verbose" => env("GIT_FTP_VERBOSE", true), "auto_init" => env("GIT_FTP_AUTO_INIT", true), ], ];
Configuration
Add your FTP credentials to your .env file:
# Staging Environment STAGING_FTP_HOST=ftp.yoursite.com STAGING_FTP_USERNAME=your-username STAGING_FTP_PASSWORD=your-password STAGING_FTP_PATH=/public_html/staging/ # Production Environment PROD_FTP_HOST=ftp.yoursite.com PROD_FTP_USERNAME=your-username PROD_FTP_PASSWORD=your-password PROD_FTP_PATH=/public_html/ # Build Command (optional) FTP_BUILD_COMMAND="npm run build" # Git Bash Path GIT_BASH_PATH="C:\Program Files\Git\bin\bash.exe"
Usage
Basic Deployment
Deploy to staging:
php artisan deploy:ftp --env=staging
Deploy to production:
php artisan deploy:ftp --env=production
Interactive environment selection:
php artisan deploy:ftp
Skip Build Process
Skip the build command:
php artisan deploy:ftp --skip-build
Configuration Options
The package configuration file config/ftp-deploy.php allows you to customize:
- Environments: Define multiple deployment environments
- Build Command: Command to run before deployment (default: npm run build)
- Git Bash Path: Path to Git Bash executable (Windows only)
- Git FTP Options: Additional options for git-ftp command
Git Status Checking
The package will check for:
- Uncommitted Changes: Files that have been modified but not committed
- Unpushed Commits: Commits that exist locally but haven't been pushed to origin
If either condition is found, deployment will be aborted with a detailed report.
Build Process
Before deployment, the package will run your configured build command (default: npm run build). This ensures your assets are compiled and ready for production.
FTP Deployment
The package uses git-ftp to efficiently deploy only changed files to your FTP server. It supports:
- Force push
- Verbose output
- Auto-initialization of git-ftp
- Custom sync roots and paths
Testing
Upcoming ...
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
sansanlabs/laravel-git-ftp-deployer 适用场景与选型建议
sansanlabs/laravel-git-ftp-deployer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 253 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 07 月 03 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ftp」 「laravel」 「deployment」 「sansanlabs」 「laravel-git-ftp-deployer」 「git-ftp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sansanlabs/laravel-git-ftp-deployer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sansanlabs/laravel-git-ftp-deployer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sansanlabs/laravel-git-ftp-deployer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Automated deployment template for Laravel Envoy based on Capistrano.
Morpht Development Tools
blueways deployer recipes
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
A Highly Opinionated Symfony3/4 Deployer Recipe
A Deployment/Change Log Schedule and Notes system for SilverStripe sites
统计信息
- 总下载量: 253
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-03