PHPloy – Deploy Git Repos Easily through FTP/sFTP

Let me ask you a question: How mad do you get when you have to remember which files you edited and select them on FileZilla to upload to the server? That’s right – very mad. And sometimes you just upload the whole project because you don’t remember what you edited. I have four words for that: “Been there; done that”.

Out of that frustration I set out to find a script that would use Git to determine which files I had edited, since this is what Git does best, and upload those to the server through FTP. I used a bash script for some times. But that script was a bit sloppy and not very user friendly. I searched again for something written in PHP and I found a great little script that worked great. I used it for a long time as-is. Then I needed it to support Git submodules, which it did not, and so I added that functionality and made many more improvements. Now again I needed it to support nested submodules, or in other words, submodules inside submodules, and now it it has that functionality in place too.

So, it seemed a great time to make that little script public. I’ve named it PHPloy, and it does very well what it says. It is a little PHP script that allows you to deploy files through FTP to a server. It makes use of Git to know which files it should upload and which one it should delete. It is a real time-saver.

How it works

PHPloy is very easy to use. After you have committed your changes in Git and have configured your server(s) in deploy.ini, all you have to do is run:


If you want to specify a server, you run:

phploy -s staging

Or the long form:

phploy --server staging

There is a lot more fun stuff that you can check in the project page in Github.

Behind the scene

PHPloy stores a file called .revision on the 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.

Grab it

Head over to PHPloy’s Github page to download it and learn more how to use it.