Download the PHP package winter/wn-docs-plugin without Composer
On this page you can find all versions of the php package winter/wn-docs-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download winter/wn-docs-plugin
More information about winter/wn-docs-plugin
Files in winter/wn-docs-plugin
Package wn-docs-plugin
Short Description Read and manage documentation within Winter CMS
License MIT
Homepage https://github.com/wintercms/wn-docs-plugin
Informations about the package wn-docs-plugin
Docs Plugin
Integrates a full suite of documentation direct into your Winter CMS installation. Documentation can be generated from Markdown files or analysed from PHP code.
Features
- Generate documentation locally from your plugin, or from a remote ZIP file.
- Create content-based documentation from Markdown files.
- Create API documentation from PHP doc-blocks and parsed PHP code.
- Can be used in both the Backend and CMS.
Getting started
To install the plugin, you may install it through the Winter CMS Marketplace, or you may install it using Composer:
Then, run the migrations to ensure the plugin is enabled:
Registering documentation
Documentation can be registered by adding a registerDocumentation
method to your Plugin class (Plugin.php
), and will depend on whether the documentation is content-based or API-based, and whether the documentation or code is stored locally or remotely.
The method should return an array, with the key of each item representing the "code" of the documentation, and the following parameters in an array as the value:
Parameter | Required | Description |
---|---|---|
name |
Yes | The name of this documentation. This will be displayed in documentation lists. |
type |
Yes | The type of documentation. It must be one of the following: md or php . See the Types of Documentation for more information. |
source |
Yes | Where the documentation can be sourced from. Must be either local or remote . See the Documentation Sources section for more information. |
path |
No | This will determine the path - relative to the plugin root if source is local or relative to the extracted content if remote - that the documentation or code can be found. |
url |
No | If source is remote, this will determine the URL to download the documentation source from. The URL must point to a ZIP file that can be extracted. Not needed if the source is local . |
zipFolder |
No | If source is remote, this will allow you to limit the source to a folder within the ZIP file, if the ZIP includes other files. You may also specify true to extract a single folder, if the folder name may be autogenerated. Ignored if the source is local . |
token |
No | If the source is remote, and is a private resource, you can add an authorization token to be sent with the HTTP request. Ignored if the source is local . |
tocPath |
No | Determines the path, relative to the source, where the table of contents YAML file can be found. By default, the Docs plugin will look for a toc.yaml in the root folder of the documentation source. |
image |
No | Provides an image representation of the documentation. |
ignorePaths |
No | An array of paths to ignore when finding available documentation. Each path may be specified as a glob. |
repository |
No | An array that contains the URL to the source repository, which allows the documentation to link back to the source, for example, to provide "Edit this page" links. You can specify both a url value, which represents the readable source location for both md and php type documentation, and an editUrl which represents the URL to edit the source of an md type documentation. |
For API documentation (ie. the type
parameter is php
), there are a couple of extra parameters that may be specified:
Parameter | Description |
---|---|
sourcePaths |
An array of paths to limit the API parser to. Each path may be specified as a glob. If no source paths are provided, all PHP files are parsed. Note that the ignorePaths patterns are still applied. |
Types of Documentation
The Docs plugin currently supports two types of documentation, Markdown (md
) and PHP (php
).
Markdown
Markdown is used for the generation of textual and image-based documentation, allowing for the easy writing of large amounts of documentation in a short amount of time. The Markdown documentation processor uses the CommonMark library to ensure accurate parsing of Markdown and the enabling of these useful features:
- Auto-linking of web and email addresses
- Automatic table of contents generation and anchor tags
- External link handling
- Front matter (title and meta definition)
- Markdown tables
Markdown documentation can be arranged in any way you see fit - the main table of contents can be specific in a .yaml
file available within the documentation source.
Example table of contents YAML file
Example Markdown document
PHP
PHP documentation involves parsing a PHP source code directory and determining the available API within all the source code objects, such as classes, namespaces, properties and methods.
Using the awesome PHP Parser library, the code is analyzed and derived from the signatures of all aspects of a class, as well as doc-blocks written to provide additional context for those signatures.
This allows, for example, the following class:
To be rendered into a readable documentation that outlines the available properties ($title
, $content
) and method (render()
) as readable documentation.
All versions of wn-docs-plugin with dependencies
composer/installers Version ~1.0
nikic/php-parser Version ^4.11.0
phpdocumentor/reflection-docblock Version ^5.2.2