WINDOWS: PHPloy to incrementally deploy Git-Based file changes over S/FTP

—————-
Requirements
—————-
* Git 1.8+
* PHP 5.5+
* Update the Windows paths below to match your system

—————-
Install PHP
—————-
If you don’t have PHP, follow the instructions at http://windows.php.net/

—————-
Install Git
—————-
If you don’t have Git, you can install GitHub Desktop for Windows. Download and install the application from https://desktop.github.com/
This will create a GitHub folder at C:\Users\David\Documents\GitHub in which you can put your website files.

—————-
Example File System Structure
—————-
C:\Users\David\Documents\GitHub
C:\Users\David\Documents\GitHub\PHPloy
C:\Users\David\Documents\GitHub\website1
C:\Users\David\Documents\GitHub\website2
C:\Users\David\Documents\GitHub\….

—————-
Create Web Root folders with Git
—————-
Create web root folders using GitHub Desktop using the “Create” function. It will create three files in website folder as below
C:\Users\David\Documents\GitHub\website1
C:\Users\David\Documents\GitHub\website1\.git (hidden)
C:\Users\David\Documents\GitHub\website1\.gitignore
C:\Users\David\Documents\GitHub\website1\.gitattributes
You can then put new website files or paste existing website files into that web root folder. If you website is on GitHub, you can use the “Clone” feature to clone and download the website files from GitHub.

—————-
Create PHPloy folder initialized with Git
—————-
Create a PHPloy folder using GitHub Desktop using the “Create” function. The folder could be located at C:\Users\David\Documents\GitHub\PHPloy.

—————-
Get PHPloy
—————-
Download PHPloy from https://github.com/banago/PHPloy and unzip and put the PHPloy files in a C:\Users\David\Documents\GitHub\PHPloy.

—————-
Composer
—————-
PHPloy has a file called composer.json. This file lists the PHP packages that PHPloy depends on. This file is used by Composer to read and install any packages the PHPloy project needs. If you don’t have Composer, get and install it from https://getcomposer.org/. Once it’s installed, run it in the PHPloy as follows
C:\Users\David\Documents\GitHub\PHPloy> composer install

—————-
BAT File
—————-
Edit phploy.bat with the path to your phploy.phar file, e.g. in
C:\Users\David\Documents\GitHub\PHPloy\phploy.bat, have the last line read
php C:\Users\David\Documents\GitHub\PHPloy\bin\phploy.phar &*

—————-
Initialize PHPloy
—————-
On the Windows command line, create a PHPloy init file by running the following command
C:\Users\David\Documents\GitHub\website1\> PHPloy –init
This will create a phploy.ini file in the website root folder.
C:\Users\David\Documents\GitHub\website1\phploy.ini
Do this for each web root or project folder.

—————-
Configure FTP Settings
—————-
Edit phploy.ini with your S/FTP settings. There are many optional settings in this file.

—————-
TEST
—————-
1. Add a file to your website project, e.g. C:\Users\David\Documents\GitHub\website1\testfile.txt
2. Using GitHub Desktop, check on the testfile.txt file and commit it. This commits it to Git on your local machine. It doesn’t push it to GitHub. To push it to GitHub, you’d have to associate a GitHub project and then in GitHub Desktop, push the Sync button.
3. On the Windows command line, run PHPloy, e.g. C:\Users\David\Documents\GitHub\website1\> PHPloy
This should upload testfile.txt to your server via FTP.
4. Verify by connecting to your server, e.g. over FTP, and seeing if testfile.txt file is there.
Do the same process to delete the file.