Php – the best setup for distributing a PHP application

buildsPHPtestingversion control

What is a recommended setup in terms of source control, builds, testing, bug tracking, and deployment for a downloadable PHP application (a la WordPress, phpBB, Magento, etc.)? As a developer working on the application, what would you expect? What about as a user of the application? Please describe a setup and workflow, as well as any resources you think might be relevant or helpful.

Best Answer

I've found the following approach to be workable for the app I maintain:

  1. The app is distributed as a single zip, that just has to be unzipped on a working PHP server.
  2. Navigating to the app automatically runs a set of sanity checks (PHP environment, app configuration). Errors explain in simple terms how to fix any issue that crops up.
  3. At first run, if the sanity checks pass, a configuration wizard is launched. This is disabled as soon as a settings file exists.
  4. All customer modifications are done in a special subfolder of the app, that they can copy over from old installs (backwards compatibility is maintained for this folder). Being able to do upgrades by unzipping files and copying around a few folders is a useful feature.
  5. The zip file itself is built with a command-line PHP script that is checked into the source repository. Doing a build is as simple as svn update followed by a call to build.php.
  6. Developer builds are made the same way as release builds, only with a "-no-optimize" flag passed to the build script to prevent minification and concatenation.
  7. The fact that the build script is itself PHP means that any developer can make changes to how the builds are made, without even having to log into our build server.