PHPackages                             desm-it/phploy - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. desm-it/phploy

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

desm-it/phploy
==============

PHPloy - Incremental Git (S)FTP deployment tool that supports submodules, multiple servers and rollbacks.

4.10.1(3y ago)21.1k↓16.7%2MITPHPPHP ^8.0

Since Aug 8Pushed 3y agoCompare

[ Source](https://github.com/desm-it/PHPloy)[ Packagist](https://packagist.org/packages/desm-it/phploy)[ RSS](/packages/desm-it-phploy/feed)WikiDiscussions desm-it Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (67)Used By (0)

PHPloy
======

[](#phploy)

**Version 4.10.1**Flysystem update

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 7.3+** and **Git 1.8+**.

How it works
------------

[](#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.

Install
-------

[](#install)

### Via Composer

[](#via-composer)

If you have composer installed in your machine, you can pull PHPloy globally like this:

```
composer global require "desm-it/phploy"
```

Make sure to place the `$HOME/.composer/vendor/bin` directory (or the [equivalent directory](http://stackoverflow.com/a/40470979/512277) for your OS) in your `$PATH` so the PHPloy executable can be located by your system.

### Via Phar Archive

[](#via-phar-archive)

You can install PHPloy Phar globally, in your `/usr/local/bin` directory or, locally, in your project directory. **Rename** `phploy.phar` to `phploy` for ease of use.

1. **Globally:** Move `phploy` into `/usr/local/bin`. Make it executable by running `sudo chmod +x phploy`.
2. **Locally** Move `phploy` into your project directory.

Usage
-----

[](#usage)

*When using PHPloy locally, proceed the command with `php `*

1. Run `phploy --init` in the terminal to create the `phploy.ini` file or create one manually.
2. Run `phploy` in terminal to deploy.

Windows Users: [Installing PHPloy globally on Windows](https://github.com/banago/PHPloy/issues/214)

phploy.ini
----------

[](#phployini)

The `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:

```
; This is a sample deploy.ini file. You can specify as many
; servers as you need and use normal or quickmode configuration.
;
; NOTE: If a value in the .ini file contains any non-alphanumeric
; characters it needs to be enclosed in double-quotes (").

[staging]
    scheme = sftp
    user = example
    ; When connecting via SFTP, you can opt for password-based authentication:
    pass = password
    ; Or private key-based authentication:
    privkey = 'path/to/or/contents/of/privatekey'
    host = staging-example.com
    path = /path/to/installation
    port = 22
    ; You can specify a branch to deploy from
    branch = develop
    ; File permission set on the uploaded files/directories
    permissions = 0700
    ; File permissions set on newly created directories
    directoryPerm = 0775
    ; Deploy only this directory as base directory
    base = 'directory-name/'
    ; Files that should be ignored and not uploaded to your server, but still tracked in your repository
    exclude[] = 'src/*.scss'
    exclude[] = '*.ini'
    ; Files that are ignored by Git, but you want to send the the server
    include[] = 'js/scripts.min.js'
    include[] = 'directory-name/'
    ; conditional include - if source file has changed, include file
    include[] = 'css/style.min.css:src/style.css'
    ; Directories that should be copied after deploy, from->to
    copy[] = 'public->www'
    ; Directories that should be purged before deploy
    purge-before[] = "dist/"
    ; Directories that should be purged after deploy
    purge[] = "cache/"
    ; Pre- and Post-deploy hooks
    ; Use "DQOUTE" inside your double-quoted strings to insert a literal double quote
    ; Use 'QUOTE' inside your qouted strings to insert a literal quote
    ; For example pre-deploy[] = 'echo "that'QUOTE's nice"' to get a literal "that's".
    ; That workaround is based on http://php.net/manual/de/function.parse-ini-file.php#70847
    pre-deploy[] = "wget http://staging-example.com/pre-deploy/test.php --spider --quiet"
    post-deploy[] = "wget http://staging-example.com/post-deploy/test.php --spider --quiet"
    ; Works only via SSH2 connection
    pre-deploy-remote[] = "touch .maintenance"
    post-deploy-remote[] = "mv cache cache2"
    post-deploy-remote[] = "rm .maintenance"
    ; You can specify a timeout for the underlying connection which might be useful for long running remote
    ; operations (cache clear, dependency update, etc.)
    timeout = 60

[production]
    quickmode = ftp://example:password@production-example.com:21/path/to/installation
    passive = true
    ssl = false
    ; You can specify a branch to deploy from
    branch = master
    ; File permission set on the uploaded files/directories
    permissions = 0774
    ; File permissions set on newly created directories
    directoryPerm = 0755
    ; Files that should be ignored and not uploaded to your server, but still tracked in your repository
    exclude[] = 'libs/*'
    exclude[] = 'config/*'
    exclude[] = 'src/*.scss'
    ; Files that are ignored by Git, but you want to send the the server
    include[] = 'js/scripts.min.js'
    include[] = 'js/style.min.css'
    include[] = 'directory-name/'
    purge-before[] = "dist/"
    purge[] = "cache/"
    pre-deploy[] = "wget http://staging-example.com/pre-deploy/test.php --spider --quiet"
    post-deploy[] = "wget http://staging-example.com/post-deploy/test.php --spider --quiet"
```

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 user and password in a file called `.phploy`.

```
[staging]
    user="theUser"
    pass="thePassword"

[production]
    user="theUser"
    pass="thePassword"

```

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 `phploy.ini` file:

```
PHPLOY_HOST
PHPLOY_PORT
PHPLOY_PASS
PHPLOY_PATH
PHPLOY_USER
PHPLOY_PRIVKEY

```

These variables can be used like this;

```
$ PHPLOY_PORT="21" PHPLOY_HOST="myftphost.com" PHPLOY_USER="ftp" PHPLOY_PASS="ftp-password" PHPLOY_PATH="/home/user/public_html/example.com" phploy -s servername

```

Or export them like this, the script will automatically use them:

```
$ export PHPLOY_PORT="21"
$ export PHPLOY_HOST="myftphost.com"
$ export PHPLOY_USER="ftp"
$ export PHPLOY_PASS="ftp-password"
$ export PHPLOY_PATH="/home/user/public_html/example.com"
$ export PHPLOY_PRIVKEY="path/to/or/contents/of/privatekey"
$ phploy -s servername

```

Multiple servers
----------------

[](#multiple-servers)

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

```

or:

```
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:

```
phploy --all

```

Shared configuration (custom defaults)
--------------------------------------

[](#shared-configuration-custom-defaults)

If you specify a server configuration named `*`, all options configured in this section will be shared with other servers. This basically allows you to inject custom default values.

```
; The special '*' configuration is shared between all other configurations (think include)
[*]
    exclude[] = 'src/*'
    include[] = "dist/app.css"

; As a result both shard1 and shard2 will have the same exclude[] and include[] "default" values
[shard1]
    quickmode = ftp://example:password@shard1-example.com:21/path/to/installation

[shard2]
    quickmode = ftp://example:password@shard2-example.com:21/path/to/installation
```

Rollbacks
---------

[](#rollbacks)

**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:

```
phploy --rollback

```

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 `--rollback`.

Listing changed files
---------------------

[](#listing-changed-files)

PHPloy allows you to see what files are going to be uploaded/deleted before you actually push them. Just run:

```
phploy -l

```

Or:

```
phploy --list

```

Updating or "syncing" the remote revision
-----------------------------------------

[](#updating-or-syncing-the-remote-revision)

If you want to update the `.revision` file on the server to match your current local revision, run:

```
phploy --sync

```

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
---------------------------------------------

[](#creating-deployment-directory-on-first-deploy)

If the deployment directory does not exits, you can instruct PHPloy to create it for you:

```
phploy --force

```

Manual fresh upload
-------------------

[](#manual-fresh-upload)

If you want to do a fresh upload, even if you have deployed earlier, use the `--fresh` argument like this:

```
phploy --fresh

```

Submodules
----------

[](#submodules)

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:

```
phploy --submodules

```

Purging
-------

[](#purging)

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/"

```

To purge a directory before deployment, specify the directories in `phploy.ini` like this:

```
; relative to the deployment path
purge-before[] = "dist/"

```

Hooks
-----

[](#hooks)

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 `composer update`.

```
; 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"

```

Logging
-------

[](#logging)

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 `phploy.ini`:

```
[production]
    logger = on

```

Contribute
----------

[](#contribute)

Contributions are very welcome; PHPloy is great because of the contributors. Please check out the [issues](https://github.com/banago/PHPloy/issues).

Credits
-------

[](#credits)

- [Baki Goxhaj](https://twitter.com/banago)
- [Contributors](https://github.com/banago/PHPloy/graphs/contributors?type=a)

Version history
---------------

[](#version-history)

Please check [release history](https://github.com/desm-it/PHPloy/releases) for details.

License
-------

[](#license)

PHPloy is licensed under the MIT License (MIT).

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~50 days

Recently: every ~378 days

Total

63

Last Release

1143d ago

Major Versions

3.5.6 → 4.0.02016-03-31

PHP version history (6 changes)3.5.4PHP &gt;=5.4.0

4.5PHP &gt;=5.5.0

v4.9.1PHP &gt;=7.0.0

4.9.2PHP ^7.0

4.9.3PHP ^7.3

4.10.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/c87bd5c03752e3ed7856bffc7ae7cbb60e91efd82051392947e27db0ba2494e1?d=identicon)[desm-it](/maintainers/desm-it)

---

Top Contributors

[![banago](https://avatars.githubusercontent.com/u/339914?v=4)](https://github.com/banago "banago (276 commits)")[![JayBizzle](https://avatars.githubusercontent.com/u/340752?v=4)](https://github.com/JayBizzle "JayBizzle (31 commits)")[![mbrugger](https://avatars.githubusercontent.com/u/271325?v=4)](https://github.com/mbrugger "mbrugger (27 commits)")[![bastien-boussouf](https://avatars.githubusercontent.com/u/29279482?v=4)](https://github.com/bastien-boussouf "bastien-boussouf (25 commits)")[![peterbrinck](https://avatars.githubusercontent.com/u/6154068?v=4)](https://github.com/peterbrinck "peterbrinck (11 commits)")[![martin-sucha](https://avatars.githubusercontent.com/u/2007393?v=4)](https://github.com/martin-sucha "martin-sucha (10 commits)")[![GuidoHendriks](https://avatars.githubusercontent.com/u/5393965?v=4)](https://github.com/GuidoHendriks "GuidoHendriks (8 commits)")[![dl1ely](https://avatars.githubusercontent.com/u/427752?v=4)](https://github.com/dl1ely "dl1ely (7 commits)")[![jjeaton](https://avatars.githubusercontent.com/u/835509?v=4)](https://github.com/jjeaton "jjeaton (6 commits)")[![dsturm](https://avatars.githubusercontent.com/u/384815?v=4)](https://github.com/dsturm "dsturm (5 commits)")[![jarbitlira](https://avatars.githubusercontent.com/u/3398354?v=4)](https://github.com/jarbitlira "jarbitlira (5 commits)")[![martinkryl](https://avatars.githubusercontent.com/u/4144447?v=4)](https://github.com/martinkryl "martinkryl (5 commits)")[![desm-it](https://avatars.githubusercontent.com/u/46482410?v=4)](https://github.com/desm-it "desm-it (5 commits)")[![Schnoop](https://avatars.githubusercontent.com/u/1263407?v=4)](https://github.com/Schnoop "Schnoop (5 commits)")[![ogrosko](https://avatars.githubusercontent.com/u/2938503?v=4)](https://github.com/ogrosko "ogrosko (4 commits)")[![mikaelz](https://avatars.githubusercontent.com/u/454800?v=4)](https://github.com/mikaelz "mikaelz (4 commits)")[![thyyppa](https://avatars.githubusercontent.com/u/3464288?v=4)](https://github.com/thyyppa "thyyppa (3 commits)")[![fadion](https://avatars.githubusercontent.com/u/374519?v=4)](https://github.com/fadion "fadion (3 commits)")[![sumpygump](https://avatars.githubusercontent.com/u/676007?v=4)](https://github.com/sumpygump "sumpygump (3 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

ftpsftpgitdeploy

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/desm-it-phploy/health.svg)

```
[![Health](https://phpackages.com/badges/desm-it-phploy/health.svg)](https://phpackages.com/packages/desm-it-phploy)
```

###  Alternatives

[banago/phploy

PHPloy - Incremental Git (S)FTP deployment tool that supports submodules, multiple servers and rollbacks.

1.4k47.2k](/packages/banago-phploy)[brunodebarros/git-deploy-php

git-deploy-php is a simple php-based tool that deploys your Git repositories to FTP/SFTP servers, and keeps them updated automatically.

2921.2k](/packages/brunodebarros-git-deploy-php)[pomander/pomander

Deployment for PHP

19815.7k2](/packages/pomander-pomander)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
