Skip to end of metadata
Go to start of metadata

<ac:macro ac:name="toc"><ac:parameter ac:name="maxLevel">3</ac:parameter></ac:macro>

<p>Authors: Rob Allen, Gary Hockin, Matthew Weier O'Phinney, Enrico Zimuel</p>


<p>The current Zend Framework documentation suffers from a number of issues, most prominently:</p>

<li>No good tutorial. The "learning" section is unstructured, and the quick start does not cover a cohesive example. Additionally, no examples are carried throughout the documentation.</li>
<li><strong>Missing information.</strong>
<li>Much of the documentation does not cover all configuration options or available functionality, including available methods.</li>
<li>Most components do not include complete examples.</li>
<li>Extension points are often not discussed in complete detail. (Example given: most interfaces available are not detailed in the documentation.)</li>
<li><strong>Unpredictable format.</strong>
<li>Each component documents things in a slightly different way, making discovery of features difficult.</li>
<li>Some components will list options in one format, others in an entirely different way. This makes finding and understanding the options difficult.</li>
<li>Documentation is difficult to create, as it requires learning DocBook, and having a working DocBook toolchain available to lint and render documentation. Currently, this means either having a unix-like environment or Cygwin.</li>

<p>After some brainstorming and discussion, we feel:</p>

<li>The manual should consist of two distinct entities: an end-user or tutorial, and the reference manual.</li>
<li>Documentation in the reference manual should follow a standard structure for each entity documented.</li>
<li>We should move to a format that's more concise and easier to learn, specifically reStructuredText and Sphinx.</li>

<h2>End-user or tutorial documentation</h2>

<p>This documentation should be primarily a narrative, following along in the development of a working example application. The example application should be sufficiently non-trivial to allow discussion of a wide swath of ZF2 features, including the MVC and related components, DB, Authentication and ACL, and features such as navigation and pagination.</p>

<p>At this time, we are planning on re-purposing the "Album" application from <a href="">Rob Allen's ZF2 tutorial</a>, as it demonstrates many of these features already.</p>

<p>The documentation will begin with a quick start guide to developing with ZF2, demonstrate installing modules, and then module creation.</p>


<p>Many ZF users have indicated that we should take an additional idea from the PHP manual, and use a standard layout for every component and/or class. This will provide several benefits:</p>

<li>Component authors know exactly what documentation they must provide, and how to do so.</li>
<li>Users know exactly where to look for specific functionality of a component and/or class.</li>
<li>Such an approach lends itself well to consistency of URLs as well, further increasing predictablity.</li>

<h3>Theory of Operation</h3>

<p>First, all components will include sections on the following:</p>

<li><strong>Overview</strong>, which will detail the problem the component addresses, as well as theory of operation.</li>
<li><strong>Quick Start</strong>, which will provide an overview and examples detailing the most common use case(s).</li>
<li><strong>Configuration Options</strong>, which will provide an overview of each configuration option available (if any), including accepted values.</li>
<li><strong>Available Methods</strong>, which will detail each available method, the arguments it accepts, and the return value.</li>
<li><strong>Examples</strong>, which will be a "cookbook" like chapter, showing additional use cases. This section will likely expand for each component over time to cover frequently asked questions.</li>

<p>This proposal does not currently seek to address components with adapters, plugins, helpers, etc.; a later proposal will address structure for such components. </p>


<p>Identifiers will be named after the namespace and component; "CamelCased" names will be converted to "lowercase-dash-separated". Files will be named after the top-level identifier in the document; e.g., "Zend\Loader\ClassMapAutoloader" would be represented with the identifier "zend.loader.class-map-autolaoder", in the file "zend.loader.class-map-autoloader.<ext>" (<ext> will likely be "rst" if we use reStructuredText, per this RFC).</p>

<h4>XML Structure</h4>

<p>While we likely will not use DocBook as the final structure, it is a good format for illustrating the proposed document structure.</p>

<ac:macro ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<!-- Reviewed: no -->
<section id="zend.loader.class-map-autoloader">
<info><title>The ClassMapAutoloader</title></info>

<section id="zend.loader.class-map-autoloader.intro">

<section id="zend.loader.class-map-autoloader.quick-start">
<info><title>Quick Start</title></info>

<section id="zend.loader.class-map-autoloader.options">
<info><title>Configuration Options</title></info>

<title>ClassMapAutoloader Options</title>



<section id="zend.loader.class-map-autoloader.methods">
<info><title>Available Methods</title></info>

<varlistentry id="zend.loader.class-map-autoloader.methods.method-name">


<section id="zend.loader.class-map-autoloader.examples">

<example id="zend.loader.class-map-autoloader.examples.example-name">


<programlisting language="php"><![CDATA[

<p>We will likely develop a tool to autogenerate the "Methods" section from the class files; this will speed up writing these sections, and provide a nice skeleton from which to work.</p>


<li><a href="">ClassMapAutoloader example</a></li>
<li><a href="">SplAutloader example</a></li>
<li><a href="">StandardAutoloader example</a></li>
<li><a href="">AutoloaderFactory example</a></li>
<li><a href="">classmap_generator.php example</a></li>

<h2>Use reStructuredText and Sphinx</h2>

<p><a href="">reStructuredText and Sphinx</a> are tools for developing project documentation. reStructuredText is a simple markup language similar to Markdown. Unlike markdown, however, it supports defining labels and cross-referencing – in otherwords, inter-document linking. Additionally, it supports features we use in DocBook currently, such as notes and warnings, and language-specific syntax highlighting of code examples. </p>

<p>One concern for the ZF documentation has always been supporting multiple output formats. Sphinx allows generating HTML, LaTeX (and thus PDF), Windows HTML help files, manual pages, and even simply plain text.</p>

<p>One final concern is search. Right now, the ZF team manually creates Lucene indices for each new release, and has code for searching those indices in the website. reST+Sphinx do not offer this out of the box. This gives us two options. First, we can do similarly to what we do now, which is index the generated markup. Alternately, we can use a service such as <a href="">Read the Docs</a>, which will auto-compile our documentation from our repository using Sphinx, and provide search for the generated documentation.</p>

<p><a href="">Read the Docs</a> would fill several roles: search capabilities, version-specific documentation, and syntax checking/preview. We feel these benefits alone make a switch in formats quite compelling.</p>


<p>Of course, migration is an issue should we choose this approach. Fortunately, there are tools to help automate the process. <a href="">pandoc</a> is one such tool; <a href="">Zeta Components' Document component</a> is another. We will likely need to experiment with both tools to find the one that best suits our needs, and document issues we run across so as to better understand what manual processes will be needed to complete migration.</p>

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.