Download the PHP library banago/phploy
On this page you can find all versions of the php package banago/phploy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
All versions of phploy with dependencies
Informations about the package phploy
PHPloy is an incremental Git FTP and SFTP deployment tool. By keeping track of the state of the remote server(s) it deploys only the files that were committed since the last deployment. PHPloy supports submodules, sub-submodules, deploying to multiple servers and rollbacks. PHPloy requires PHP 5.5+ and Git 1.8+.
How it works
PHPloy stores a file called
.revision on your server. This file contains the hash of the commit that you have deployed to that server. When you run phploy, it downloads that file and compares the commit reference in it with the commit you are trying to deploy to find out which files to upload. PHPloy also stores a
.revision file for each submodule in your repository.
If you have composer installed in your machine, you can pull PHPloy globally like this:
Make sure to place the
$HOME/.composer/vendor/bin directory (or the equivalent directory for your OS)
$PATH so the PHPloy executable can be located by your system.
Via Phar Archive
You can install PHPloy Phar globally, in your
/usr/local/bin directory or, locally, in your project directory. Rename
phploy for ease of use.
- Globally: Move
/usr/local/bin. Make it executable by running
sudo chmod +x phploy.
- Locally Move
phployinto your project directory.
When using PHPloy locally, proceed the command with
phploy --initin the terminal to create the
phploy.inifile or create one manually.
phployin terminal to deploy.
Windows Users: Installing PHPloy globally on Windows
phploy.ini file holds your project configuration. It should be located in the root directory of the project.
phploy.ini is never uploaded to server. Check the sample below for all available options:
If your password is missing in the
phploy.ini file or the
PHPLOY_PASS environment variable, PHPloy will interactively ask you for your password.
There is also an option to store the password in a file called
This feature is especially useful if you would like to share your phploy.ini via Git but hide your password from the public.
You can also use environment variables to deploy without storing your credentials in a file.
These variables will be used if they do not exist in the
These variables can be used like this;
Or export them like this, the script will automatically use them:
PHPloy allows you to configure multiple servers in the deploy file and deploy to any of them with ease.
By default PHPloy will deploy to ALL specified servers. Alternatively, if an entry named 'default' exists in your server configuration, PHPloy will default to that server configuration. To specify one single server, run:
phploy -s servername
phploy --server servername
servername stands for the name you have given to the server in the
phploy.ini configuration file.
If you have a 'default' server configured, you can specify to deploy to all configured servers by running:
Warning: the --rollback option does not currently update your submodules correctly.
PHPloy allows you to roll back to an earlier version when you need to. Rolling back is very easy.
To roll back to the previous commit, you just run:
To roll back to whatever commit you want, you run:
phploy --rollback commit-hash-goes-here
When you run a rollback, the files in your working copy will revert temporarily to the version of the rollback you are deploying. When the deployment has finished, everything will go back as it was.
Note that there is not a short version of
Listing changed files
PHPloy allows you to see what files are going to be uploaded/deleted before you actually push them. Just run:
Updating or "syncing" the remote revision
If you want to update the
.revision file on the server to match your current local revision, run:
If you want to set it to a previous commit revision, just specify the revision like this:
phploy --sync your-revision-hash-here
Creating deployment directory on first deploy
If the deployment directory does not exits, you can instruct PHPloy to create it for you:
Manual fresh upload
If you want to do a fresh upload, even if you have deployed earlier, use the
--fresh argument like this:
Submodules are supported, but are turned off by default since you don't expect them to change very often and you only update them once in a while. To run a deployment with submodule scanning, add the
--submodules parameter to the command:
In many cases, we need to purge the contents of a directory after a deployment. This can be achieved by specifying the directories in
phploy.ini like this:
; relative to the deployment path purge = "cache/"
PHPloy allows you to execute commands before and after the deployment. For example you can use
wget call a script on my server to execute a
; To execute before deployment pre-deploy = "wget http://staging-example.com/pre-deploy/test.php --spider --quiet" ; To execute after deployment post-deploy = "wget http://staging-example.com/post-deploy/test.php --spider --quiet"
PHPloy supports simple logging of the activity. Logging is saved in a
phploy.log file in your project in the following format:
2016-03-28 08:12:37+02:00 --- INFO: [SHA: 59a387c26641f731df6f0d1098aaa86cd55f4382] Deployment to server: "default" from branch "master". 2 files uploaded; 0 files deleted.
To turn logging on, add this to
[production] logger = on
Contributions are very welcome; PHPloy is great because of the contributors. Please check out the issues.
Please check release history for details.
PHPloy is licensed under the MIT License (MIT).