Download the PHP package eriktorsner/wp-deployhelper without Composer

On this page you can find all versions of the php package eriktorsner/wp-deployhelper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-deployhelper

wp-deployhelper

Simple command line utility to assist deployments via ftp. Intended for the specific condition where a remote server is accessible via ftp and http. Typically, this is the case when deploying to shared host like Bluehost or GoDaddy standard web accounts.

wp-deployhelper was originally written as a support package for WP Bootstrap, a deployment tool for WordPress, hence the name.

Concept

wp-deployhelper uses a combination of ftp and http to transfer compressed sets of changed files to a remote server. By keeping track of both local and remote state, the number of files transferred can be kept to a minimum speed kept to a maximum. Typical time to transfer a standard (empty) WordPress install to Bluehost is around 30s on the first transfer and 5-8s for incremental updates.

wp-deployhelper also comes with a rewrite feature that allows individual files to be rewritten using regular expressions after unpack. Typically used to change passwords or database host in configuration files.

Installation

To add this package as a local, per-project dependency to your project, simply add a dependency on eriktorsner/wp-deployhelper to your project's composer.json file. Here is a minimal example of a composer.json file that just defines a dependency wp-bootstrap:

{
    "require": {
        "eriktorsner/wp-deployhelper": "0.1.*"
    }
}

Then

$ composer update

Configuration

wp-deployhelper uses a single json configuration file that needs to be in the project root folder named ftpsettings.json.

{
    "host": "ftp.mydomain.com",
    "user": "mydomain",
    "pass": "secret",
    "remotePath": "/public_html",
    "localPath": "/vagrant/www/wordpress-default",
    "httpUrl": "www.mydomain.com",
    "rewrite": [{
        "file": "/wp-config.php",
        "pattern": "/define\\('DB_HOST', '.+'\\);/i",
        "replace": "define('DB_HOST', 'localhost');"
    }]
}
Name Description
host ftp host name
user ftp user name
pass ftp password
remotePath path on the remote server
localPath path on the local server
httpUrl http url that corresponds to the remote path
rewrite rerwrite rules, see below

Notes: host, user and pass are used to connect to the remote server using the standard php ftp client. Currently no support for alternative ports etc.

remotePath and httpUrl needs to match. A php script will be uploaded to the remote path and is expected to be accessible using the httpUrl, if these don't match, wp-deployhelper will not work at all.

Rewrite rules The rewrite rules are an array of objects, each representing a rule. On files that matches the file name/glob pattern a preg_replace will be made. If the preg_replace results in any hits, the file is saved with its new content.

Running

wp-deplyhelper only has one command with no arguments:

$ vendor/bin/wp-deployhelper deploy

Saved state

After each run local and remote state is saved in the subfolder wp-deployhelper directly under the project root. There's currently no way to alter the state folder path or name.

Rules

The rules for what files to transfer or delete are currently not configurable. The intended use case is that the local server controls what files that are supposed to exist on the server. However, files that are added "runtime" on the server will not be removed.

Local Remote Result Reasoning
NEW, MOD * Copied to remote Any new or modified local file will be transferred regardless of remote state
EXISTS DEL, MOD Copied to remote A remotely modified or deleted file will be replaced by the original from local
DEL * Deleted from remote Deleted local file will delete the file remotely
* NEW No action Files added remotely are assumed to be correctly added by the application itself

Note: A locally renamed file will be treated as two files. One deleted and one new.

Detailed description

Step 1. wp-deployhelper works by creating a complete (recursive) list of all local and remote files. To get the remote index, a php a script is pushed to the target server to take advantage of the php scandir fundtion rather than relying on indexing via ftp (slow). The two indexes as first compared against saved state for both the local and remote sides to figure out which files that needs to be transferred or deleted on the remote server.

Step 2. In the next step, wp-deployhelper creates a zip archive with all the needed files as well as some meta information. The zip archive is then sent to the target server via ftp (to avoid potential file upload limitations). The php scrip is then called to unpack the archive, delete files that should be deleted etc.

Step 3. As the last step, wp-deployhelper takes a new index of the remote state and saves both the local and remote states.

On the local side, the indexing process uses md5 file hashes to detect modified files. But for performance reasons, the remote side just hashes modification and file size. Theoretically, it's possible to do changes on remote files that goes undetected, but in reality that should be rare.

Security

Currently wp-deployhelper is rather insecure since it relies on plain ftp for the file transfers. To increase security, wp-deployhelper uses a (pseudo) random file name for the script and zip file. Each time the tool runs, a new random name is created. As soon as the process is finished both the zip and php files are removed from the target server.

Version history

0.1.0


All versions of wp-deployhelper with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package eriktorsner/wp-deployhelper contains the following files

Loading the files please wait ....