By request: what's my workflow for writing books? A long time ago I noticed that testing-advocate Chris Hartjes published his books on https://leanpub.com.
When I include the output of tools like PHPUnit in the book, I don't want to copy/paste it from the terminal either. When I make a change to the code, the output should be regenerated automatically and included in the book.