{"id":25222784,"url":"https://github.com/dg/ftp-deployment","last_synced_at":"2025-05-14T03:06:37.767Z","repository":{"id":4686801,"uuid":"5833545","full_name":"dg/ftp-deployment","owner":"dg","description":"A tool for automated deployment of web applications to an FTP server.","archived":false,"fork":false,"pushed_at":"2025-03-31T00:40:25.000Z","size":30877,"stargazers_count":610,"open_issues_count":13,"forks_count":90,"subscribers_count":53,"default_branch":"master","last_synced_at":"2025-04-08T08:11:09.949Z","etag":null,"topics":["ftp","php","ssh","synchronization"],"latest_commit_sha":null,"homepage":"https://nette.org","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dg.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":".github/funding.yml","license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"dg"}},"created_at":"2012-09-16T21:49:28.000Z","updated_at":"2025-04-01T16:42:35.000Z","dependencies_parsed_at":"2024-03-19T23:25:57.035Z","dependency_job_id":"3fa9ac79-4004-4535-817f-e8553298620d","html_url":"https://github.com/dg/ftp-deployment","commit_stats":{"total_commits":289,"total_committers":30,"mean_commits":9.633333333333333,"dds":"0.15916955017301038","last_synced_commit":"217c0199aaae3263e121c64ae3a8181ac6a32a3c"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dg%2Fftp-deployment","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dg%2Fftp-deployment/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dg%2Fftp-deployment/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dg%2Fftp-deployment/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dg","download_url":"https://codeload.github.com/dg/ftp-deployment/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254059500,"owners_count":22007768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ftp","php","ssh","synchronization"],"created_at":"2025-02-10T23:42:59.314Z","updated_at":"2025-05-14T03:06:37.730Z","avatar_url":"https://github.com/dg.png","language":"PHP","readme":"FTP Deployment: smart upload\n============================\n\n[![Downloads this Month](https://img.shields.io/packagist/dm/dg/ftp-deployment.svg)](https://packagist.org/packages/dg/ftp-deployment)\n[![Tests](https://github.com/dg/ftp-deployment/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/dg/ftp-deployment/actions/workflows/tests.yml)\n[![Latest Stable Version](https://poser.pugx.org/dg/ftp-deployment/v/stable)](https://github.com/dg/ftp-deployment/releases)\n[![License](https://img.shields.io/badge/license-New%20BSD-blue.svg)](https://github.com/dg/ftp-deployment/blob/master/license.md)\n\nFTP deployment is a tool for automated deployment to an FTP server.\n\nThere is nothing worse than uploading web applications to FTP server manually,\nusing tools like Total Commander. (Although, editing files directly on the server\nand then trying to keep some kind of synchronization is even worse ;-)\n\nOnce the process is automated, it costs you a fraction of time and minimizes the risk of error\n(didn't I forget to upload some files?). There are lots of sophisticated deploying techniques available today,\nbut many people are still using FTP. This tool is designed for them.\n\n\nSupport Me\n----------\n\nDo you like FTP Deployment? Are you looking forward to the new features?\n\n[![Buy me a coffee](https://files.nette.org/icons/donation-3.svg)](https://github.com/sponsors/dg)\n\nThank you!\n\n\nHow it Works\n------------\n\nFTP Deployment is a script written in PHP and will automate\nthe entire process. Just say which local folder to upload and where. This\ninformation is stored in a `deployment.ini` text file, which you can associate\nwith `deployment` script, so deployment will become a one click thing.\n\n```\nphp deployment deployment.ini\n```\n\nAnd what does the `deployment.ini` file contain? **Only the `remote` item is required**, all the others are optional:\n\n```ini\n; log file (defaults to config file with .log extension)\nlog = ...\n\n; directory for temporary files (defaults to system's temporary directory)\ntempDir = /temp/deployment\n\n; enable colored highlights? (defaults to autodetect)\ncolors = yes\n\n[my site] ; Optional section (there may be more than one section).\n; remote FTP server\nremote = ftp://user:secretpassword@ftp.example.com/directory\n; you can use ftps://, sftp://, file:// or phpsec:// protocols (sftp requires SSH2 extension; phpsec uses phpseclib library)\n\n; do not like to specify user \u0026 password in 'remote'? Use these options:\nuser = ...\npassword = ...\n\n; FTP passive mode\npassiveMode = yes\n\n; local path (optional)\nlocal = .\n\n; run in test-mode? (can be enabled by option -t or --test)\ntest = no\n\n; files and directories to ignore\nignore = \"\n\t.git*\n\tproject.pp[jx]\n\t/deployment.*\n\t/log\n\ttemp/*\n\t!temp/.htaccess\n\"\n\n; explicit list of files and directories to include (by default includes all files and directories)\ninclude = \"\n\t/app\n\t/app/*\n\t/index.php\n\"\n\n; is allowed to delete remote files? (defaults to yes)\nallowDelete = yes\n\n; jobs to run before uploading\n; local jobs are done even if there is no need for synchronization\nbefore[] = local: git diff-index --quiet HEAD  ; ensures Git working directory is clean\nbefore[] = local: composer install --no-dev --classmap-authoritative  ; installs production vendor\nbefore[] = local: lessc assets/combined.less assets/combined.css\nbefore[] = http://example.com/deployment.php?before\n\n; jobs to run after uploading and before uploaded files are renamed\nafterUpload[] = http://example.com/deployment.php?afterUpload\n\n; directories to purge after uploading\npurge[] = temp/cache\n\n; jobs to run after everything (upload, rename, delete, purge) is done\n; local jobs are done even if the synchronization did not take place\nafter[] = remote: unzip api.zip\nafter[] = remote: chmod 0777 temp/cache  ; change permissions\nafter[] = upload: config.server.neon app/config.local.neon\nafter[] = http://example.com/deployment.php?after\nafter[] = local: git reset HEAD --hard   ; reverts all changes in working directory\n\n; files to preprocess (defaults to none)\npreprocess = *.js *.css\n\n; file which contains hashes of all uploaded files (defaults to .htdeployment)\ndeploymentFile = .deployment\n\n; default permissions for new files (defaults to none)\nfilePermissions = 0644\n\n; default permissions for new directories (defaults to none)\ndirPermissions = 0755\n```\n\nIn the config file you can create multiple sections (like `[my site]`), so you may have separate\nrules for data and for application.\n\nConfiguration can also be stored in a [PHP file](deployment.sample.php).\n\nIn test mode (with `-t` option) uploading or deleting files is skipped, so you can use it\nto verify your settings.\n\nItem `ignore` uses the similar format to [`.gitignore`](http://git-scm.com/docs/gitignore):\n\n```\nlog - ignore all 'log' files or directories in all subfolders\n/log - ignore 'log' file or directory in the root\napp/log - ignore 'log' file or directory in the 'app' in the root\ndata/* - ignore everything inside the 'data' folder, but the folder will be created on FTP\n!data/db/file.sdb - make an exception for the previous rule and do not ignore file 'file.sdb'\nproject.pp[jx] - ignore files or folders 'project.ppj' and 'project.ppx'\n```\n\nBefore the upload starts, after it finishes and after all jobs, you can execute commands or call your scripts on\nthe server (see `before`, `afterUpload`, `after`), which can, for example, switch the server to a maintenance mode.\nIf you use PHP config, you can run lambda function with deployment environment:\n\n```php\n\u003c?php\n\nreturn [\n\t'remote' =\u003e 'ftp://user:secretpassword@ftp.example.com/directory',\n\t'local' =\u003e '.',\n\t'before' =\u003e [\n\t\tfunction (Deployment\\Server $server, Deployment\\Logger $logger, Deployment\\Deployer $deployer) {\n\t\t\t... do something\n\t\t},\n\t],\n\t...\n];\n```\n\nSyncing a large number of files attempts to run in (something like) a transaction: all files are\nuploaded with extension `.deploytmp` and then quickly renamed.\n\nAn `.htdeployment` file is uploaded to the server, which contains MD5 hashes of all the files and\nis used for synchronization. So the next time you run `deployment`, only modified files are uploaded\nand deleted files are deleted from server (if it is not forbidden by the `allowDelete` directive).\n\nUploaded files can be processed by a preprocessor. These rules are predefined: `.css` files\nare compressed using the clean-css and `.js` are minified by UglifyJS or UglifyES (both via Node.js tool).\n\nThere is also a rule for expanding [mod_include](http://httpd.apache.org/docs/current/mod/mod_include.html) Apache directives.\nFor example, you can create a file `combined.js`:\n\n```\n\u003c!--#include file=\"jquery.js\" --\u003e\n\u003c!--#include file=\"jquery.fancybox.js\" --\u003e\n\u003c!--#include file=\"main.js\" --\u003e\n```\n\nThis tool will combine scripts together and minify them with the Closure Compiler to speed-up your website.\n\n\nInstalling FTP Deployment\n-------------------------\n\nFTP Deployment 3.6 requires PHP 8.0 or later. It also requires openssl extensions for ftps:// and SSH2 extension for sftp:// connections.\n\nThe easiest way to obtain FTP Deployment is to download [a single PHAR file](https://github.com/dg/ftp-deployment/releases).\n\nIf you want to use minification, install [Node.js](https://nodejs.org/en/), [UglifyJS 3](https://www.npmjs.com/package/uglify-js)\nfor JavaScript minification and [clean-css](https://www.npmjs.com/package/clean-css-cli) for CSS minification.\n\n```\nnpm install uglify-js -g\nnpm install clean-css-cli -g\n```\n\n\nOr you can install it using Composer:\n\n```\ncomposer create-project dg/ftp-deployment\n```\n\nAre you looking for php_ssh2.dll?\n- [php_ssh2.dll for PHP 8.0 x64](https://files.nette.org/misc/8.0-x64/php_ssh2.dll)\n- [php_ssh2.dll for PHP 8.1 x64](https://files.nette.org/misc/8.1-x64/php_ssh2.dll)\n- [php_ssh2.dll for PHP 8.2 x64](https://files.nette.org/misc/8.2-x64/php_ssh2.dll)\n\nNeed SSH authenticate using a public key?\n\n```\npublicKey = '/key/id_rsa.pub'\nprivateKey = '/key/id_rsa'\npassPhrase = 'yourpass' #optional - If needed passphrase for privateKey\n```\n","funding_links":["https://github.com/sponsors/dg"],"categories":["🚀 DevOps \u0026 Infrastructure"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdg%2Fftp-deployment","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdg%2Fftp-deployment","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdg%2Fftp-deployment/lists"}