|
| 1 | +============ |
| 2 | +Architecture |
| 3 | +============ |
| 4 | + |
| 5 | +The project is built around the core library that is called ``guides``. This library |
| 6 | +contains all core components of the project. Like the different layers :ref:`parser-component`, |
| 7 | +:ref:`compiler-component` and :ref:`renderer-component` and includes the basic Nodes and templates to create |
| 8 | +output. |
| 9 | + |
| 10 | +Installation of the core library can be done using ``composer``: |
| 11 | + |
| 12 | +.. code-block:: bash |
| 13 | +
|
| 14 | + composer require phpdocumentor/guides |
| 15 | +
|
| 16 | +The other components are using the core library and extend it with additional |
| 17 | +functionality. For example the ``guides-markdown`` component adds support for |
| 18 | +Markdown documents and the ``guides-restructuredtext`` component adds support for |
| 19 | +ReStructuredText documents. |
| 20 | + |
| 21 | +All components are designed to be open for extension so you can bring your own parser, |
| 22 | +template engine or other component. The core library is designed to be the glue between |
| 23 | +all components. |
| 24 | + |
| 25 | +The ``guides``, ``guides-markdown`` and ``guides-restructuredtext`` are seen as the main |
| 26 | +libaries of the project. The other components are optional and can be used to extend the |
| 27 | +functionality of the main libraries for specific use cases. |
| 28 | + |
| 29 | +Application flow |
| 30 | +================ |
| 31 | + |
| 32 | +Processing documents is done in a few steps. |
| 33 | + |
| 34 | +#. :php:class:`Parsing <\phpDocumentor\Guides\Parser>` The first step is to parse the document. |
| 35 | + This is done by the :ref:`parser-component` component. The |
| 36 | + parser component will parse the document and create a tree of nodes. Each node |
| 37 | + represents a part of the document. For example a paragraph, a list or a table. |
| 38 | +#. :php:class:`Compiling <\phpDocumentor\Guides\Compiler\Compiler>` The second step is to compile the tree of nodes. |
| 39 | + This is done by the :ref:`compiler-component` |
| 40 | + component. During the compilation, modifications can be made to the tree of nodes. For |
| 41 | + example the compiler can add a table of contents to the tree of nodes. |
| 42 | + |
| 43 | +#. :php:class:`Rendering <\phpDocumentor\Guides\Renderer\BaseTypeRenderer>` The third step is to render |
| 44 | + the tree of nodes. This is done by the :ref:`renderer-component` |
| 45 | + component. The render component will render the tree of nodes to a specific output |
| 46 | + format. By default twig templates are used to render nodes to HTML. But you can |
| 47 | + create your own templates to render nodes to other formats. Or implement your own |
| 48 | + renderer to use a different template engine. |
| 49 | + |
| 50 | +.. uml:: _uml/application-flow.puml |
| 51 | + :caption: Application flow |
0 commit comments