PHPloy – Deploy Git Repos Easily through FTP/sFTP

PHPloy - PHP Git Deploy

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.

Baki Goxhaj
Iā€™m a web consultant specializing in WordPress. I love elegant solutions, quality code and a good laughter.
You may also like
How to Limit Content in WordPress
How to Install and Configure Git on Ubuntu
  • mike Mar 4,2017 at 10:12 pm

    Old post, I know, but thanks for this tool. Really appreciate the work.

    • Baki Goxhaj Mar 5,2017 at 6:43 am

      Thanks Mike, I really your appreciate it. šŸ™‚

  • Evert Albers May 3,2016 at 11:26 am

    I am wondering if there is still a usecase for PHPLoy when I am already using automation via grunt/gulp/ftp?

  • Chris Apr 29,2016 at 11:56 am


    it is posible to deploy only a subdirectory of my repository? Because only one folder of my repository contains the codebase for the server. But the name of this folder does not match the folder name on the server.

    • Baki Goxhaj Apr 29,2016 at 1:02 pm

      Yes, it is possible. You use the copy settings in phploy.ini.

  • Md Habibi Dec 25,2015 at 3:47 am

    Impressive!! thx alot!!

  • directorlector Sep 9,2015 at 8:50 pm

    You should use phpseclib for SFTP instead of libssh2. phpseclib has a number of advantages over libssh2 including, surprisingly, speed. More info:

  • Ben Apr 20,2015 at 12:55 pm

    So so so cool !
    Thank you very much this is exactly what I needed ! The multiserver feature is amazing !
    Have a good day !
    Thanks from France !

  • Rifky Mar 25,2015 at 2:18 am

    Hi, what is the path we need to mention inside the bat file.

    at line 20
    php C:\path\to\phploy %*

    i’m windows 7 64 bit

    • Baki Goxhaj Mar 25,2015 at 5:08 pm

      Please open an issue in Github so our Windows contributor can look at the issue. Thanks!

  • Chrisdigital Jan 27,2015 at 1:01 am

    Very cool. For those of you (like me) that are looking for effect models for branching and working with git. Check out this post that helped me get it understand tagging. version #’ing, and etc. a little better: Cheers!

  • Nicola Oct 22,2014 at 2:23 pm

    Thanks for this! It works like a charm.
    Any chance of getting PHPloy watching file changes?


  • Scott Jun 11,2014 at 3:51 pm

    Baki, I saw your tweet on this tool, thanks for the heads up. It sounds promising. Frankly, my biggest challenge at this point is trying to figure out what to put under version control, and getting comfortable with git’s workflow. Initially I was thinking entire site, then backed down to child theme files, now considering plugins as well. The other piece beyond VC’d files is the db migration strategy. I’ve come across several tools but haven’t tried any of them yet. Setting up a new site was pretty straight forward, but now changing to a new child theme w/ mods, and upgrading an existing not yet in VC has been a lot to think/work through. Good thing I don’t have traffic…:-)

    • Baki Goxhaj Jun 12,2014 at 7:12 am

      Hey Scott, thanks for stopping by.

      I know where you are coming from. I normally put under version control only the theme I’m working on – it can be a normal theme or a child. It gives me the flexibility to keep stuff updated through WP, like plugins and core itself.

      As for the database, I seem to just skip this step. I don’t develop the content offline. I work with dummy offline and then move online with real content. Once online, migration form staging to production is pretty easy.

  • Tuan Anh Apr 23,2014 at 4:09 pm

    Hi, just found your blog by searching PHPloy šŸ™‚

    I have the same question using git and how to deploy changes to server. A friend of mine suggested PHPloy. Looks like it’s simple to use.

    Thanks for your post!

    • Baki Goxhaj Apr 23,2014 at 4:37 pm

      Yes, it’s build to be easy to use. Thanks for the comment. šŸ™‚

  • Arian Apr 8,2014 at 12:11 pm

    What an awesome little helper tool Baki.

    • Baki Goxhaj Apr 8,2014 at 1:42 pm

      Hey, thanks for dropping by. Yes, I’m in love with it šŸ™‚

Leave Your Comment

Your Comment*

Your Name*
Your Webpage