Installation

Prerequisites

In order to use this build and test environment, you need to have

  • Composer, a dependency manager for PHP
  • Docker for lightweight container virtualization
  • Docker-Compose, a Docker orchestration tool
  • DNSmasq, a local lightweight DNS server
  • GraphViz for diagrams in the API documentation

properly installed on your development system. Everything else will be retrieved automatically when it is needed.

Preparation of the build and test environment

Add the build and test environment as a submodule to your project, so build/ is managed as a project of its own within your project, giving you the opportunity to branch and tweak it and retain the updatability anyway.

$ cd <project>
$ git submodule add https://github.com/GreenCape/build.git

In the build subdirectory, call Composer to resolve the dependencies.

$ cd <project>/build
$ composer install

Copy the build.xml.dist to your project's root directory, rename it to build.xml, and adapt it to your settings. Everything but the package data should not need to be changed.

The Phing build file build.xml located in the build/phing directory provides a number of useful build targets. Most of these targets are implemented in separate files, which can be found in the build/phing directory.

The phing command is available as ./build/vendor/bin/phing. For your convenience, it is recommended to add an alias, for example

$ alias dev='./build/vendor/bin/phing'

In your project root directory, you can then issue the command

$ dev help

to list all available build targets with their description and other useful information.

Configuration of DNSmasq

To route all requests for *.dev domains to localhost, add the line

address=/dev/127.0.0.1

to the DNSmasq configuration. This is best done in its own file named dev in the /etc/dnsmasq.d directory (for Ubuntu). You may add it to /etc/dnsmasq.conf directly instead, if you want. It is set up correctly, if the output of

$ dig *.dev

contains the lines

;; ANSWER SECTION:
*.dev.			0	IN	A	127.0.0.1