Writing Your Book
So you are interested in writing a book for PHP Architect? The guidelines for our books are very similar to the ones for the magazine. If you are writing a book for us, you may already have written for the magazine and know those standards.
If you haven't, or need a refresher, start with our Magazine Editorial Guidelines, which cover the basics of our Markdown formatting. Then come back here for the few things that are different for books.
How Books Differ
Headings
Headings are still allowed at 5 levels, but the top level heading is only for chapter titles. Use them hierarchically: they build the book's table of contents, which lists the chapter titles and second level headings.
# Top level heading - Used for Chapter Titles
## Second level heading - Shown in the Table of Contents
### Third level heading
#### You get the idea
##### That wraps it up.
URLs
Our books are printed and read offline on e-readers, so every URL has to make sense on paper. There are two ways to include one. When the URL is part of the flow of the text, include it directly, surrounded by <>, just like in the magazine. When it is only reference material, use a link: it becomes a footnote in print and PDF, and stays a link in the EPUB and Mobi editions.
The website containing all things PHP is <https://php.net/>
If you need to explore all of parameters for this library you
can read the [PHP documentation](https://php.net/curl) on it.
Footnotes
Books can have footnotes. Whenever you need one, use the ^[] notation and it will be numbered and placed for you:
For this book's examples we will be following
the W3C^[World Wide Web Consortium] standards for HTML5
For a longer footnote, give it a unique identifier: put [^identifier] in the text, then write the footnote on its own line starting with [^identifier]:
For this book's examples we will be following
the W3C[^html5] standards for HTML5
[^html5]: For a complete view of the W3C standards, visit <https://www.w3.org/TR/html5/>.
Callouts
To draw attention to a passage as a callout, format it as a blockquote by starting it with >:
> It's important to make sure that you've closed your
method braces or your PHP will not compile.
Code
The rules for code are the same as for the magazine: inline code samples and code listings must not have lines longer than 60 characters. The one difference is that books are far more flexible about when to use a code sample instead of a code listing; that choice is yours.
If you are walking through the development of some code step by step, inline code samples are probably better. If you have a large block of code to refer to, a code listing (formatted with line numbers and a listing number you can refer back to) may suit it better. The second listing in chapter 3 is Listing 3.2, saved as its own file in the listings folder as listing3.2.txt. Use it in the text like this:
The code does lots of things. As you can see in Listing 3.2,
lines 15 - 20 are the important ones.
[Listing 3.2](listings/listing3.2.txt)
Figures
Name figures for the chapter and the figure's number within it. The first figure in chapter 7 is Figure 7.1, saved as figure7.1.png. Refer to it like this:
The widget works very well. You can see in the output in
Figure 7.1 that it is working well.

A figure in an appendix is named for the appendix letter instead: the third figure in Appendix B is figureB.3.png.
Assembling Your Book
The file structure for a book is simpler than for a magazine article: one .markdown file per chapter. Books usually have an acknowledgements section too, and perhaps a foreword written by someone else. The file names don't matter much as long as they sort in the right order; starting each with a two digit number helps. A book you send us might look like this:
book.zip
├─ 00.0.acknowledgements.markdown
├─ 00.1.foreword.markdown
├─ 01.chapter1.markdown
├─ 02.chapter2.markdown
├─ 03.chapter3.markdown
├─ 04.chapter4.markdown
├─ figures
│ ├─ figure3.1.png
│ └─ figure3.2.png
└─ listings
├─ listing1.1.txt
└─ listing3.2.txt
Submitting Your Book
Just like with magazine articles, when your book is complete, zip it up into a single file and email it to your editor or to editors@phparch.com. Your editor will be in touch with you throughout, and may give you other instructions or version control access to submit your book that way.
Don't Panic!
If any of these guidelines seem too complex, or if you get mixed up on how the formatting should be handled, don't panic! Your editor is here to help. Don't get too hung up on formatting; these guidelines are intended to smooth the editorial process and final layout, but we're much more concerned about getting informative text from you, the expert, than on having it formatted perfectly.
If you have any issues we'll be happy to help, and we'll share the results back with you as we work through the book together.