Looking to hire Laravel developers? Try LaraJobs

laravel-deploy-ftp maintained by amirvahedix

Description
A Laravel package to deploy files modified in Git to an FTP server based on commits, tags, or git status.
Author
Amir Vahedi
Last update
2026/08/15 17:51 (dev-main)
License
Links
Downloads
12

Comments
comments powered by Disqus

Laravel FTP Deploy (amirvahedix/laravel-deploy-ftp)

Latest Stable Version License

A lightweight Laravel package to deploy files modified in Git (plus compiled assets like public/build) to any shared hosting or server via FTP/FTPS.

Features

  • 🚀 Git-based deployment: Deploy modified files based on Git commits, tags, or git status.
  • 📁 Asset inclusion: Automatically includes compiled frontend assets (public/build).
  • 🛑 Exclusions: Automatically excludes sensitive .env files, .git/, vendor/, node_modules/, and custom specified paths.
  • ⚙️ Config & .env driven: Easily configured via config/deploy-ftp.php or .env variables.
  • 🧪 Dry-run mode: Preview files to be uploaded before performing actual transfer.

Installation

Install the package via Composer in any Laravel project:

composer require amirvahedix/laravel-deploy-ftp

(The package uses Laravel Service Discovery and will automatically register the deploy:ftp Artisan command).

Configuration

Publish the package configuration file to config/deploy-ftp.php:

php artisan vendor:publish --tag=deploy-ftp-config

Environment Variables (.env)

Add your FTP server details to your .env file:

FTP_DEPLOY_HOST=ftp.example.com
FTP_DEPLOY_USERNAME=your_username
FTP_DEPLOY_PASSWORD=your_password
FTP_DEPLOY_PORT=21
FTP_DEPLOY_SSL=false
FTP_DEPLOY_ROOT=/public_html
FTP_DEPLOY_TAG=deployed-latest

Usage

Run the deployment command:

php artisan deploy:ftp

Command Options

Option Description
--all Deploy all tracked files (useful for initial deployment)
--status Deploy modified and untracked files based on git status
--from=COMMIT Starting Git commit or tag reference to diff from
--to=COMMIT Ending Git commit (defaults to HEAD)
--dry-run Print list of files that would be uploaded without connecting/uploading
--host=HOST Override FTP host
--user=USER Override FTP username
--password=PASS Override FTP password
--port=PORT Override FTP port (default: 21)
--ssl Connect using SSL/TLS (FTPS)
--root=PATH FTP remote root folder (e.g. /public_html)
--tag=TAG Git tag to track the last deployed commit (default: deployed-latest)
--push Push the deployment Git tag to remote Git origin
--exclude=PATH Comma-separated list of additional files/directories to exclude

Examples

Simulate a full deployment (Dry Run):

php artisan deploy:ftp --all --dry-run

Deploy uncommitted / modified files from git status:

php artisan deploy:ftp --status

Deploy diff between HEAD~2 and HEAD:

php artisan deploy:ftp --from=HEAD~2 --to=HEAD

License

The MIT License (MIT). Please see License File for more information.