Make PHPCI output properly formatted JSON and Yaml files where possible, rather than one-line files.

Closes #547