BumbleDocGen / Technical description of the project / Plugin system
The documentation generator includes the ability to expand the functionality using plugins that allow you to add the necessary functionality to the system without changing its core.
The system is built on the basis of an event model, each plugin class must implement PluginInterface.
You can add your plugins to the configuration like this:
plugins:
- class: \SelfDocConfig\Plugin\RoaveStubber\BetterReflectionStubberPlugin
- class: \SelfDocConfig\Plugin\TwigFilterClassParser\TwigFilterClassParserPlugin
- class: \SelfDocConfig\Plugin\TwigFunctionClassParser\TwigFunctionClassParserPlugin
Below are the plugins that are available by default when working with the library. Plugins for any programming languages work regardless of which language handler is configured in the configuration.
| Plugin | PL | Handles events | Description |
|---|---|---|---|
| LastPageCommitter | any | Plugin for adding a block with information about the last commit and date of page update to the generated document | |
| PageHtmlLinkerPlugin | any | Adds URLs to empty links in HTML format; Links may contain: 1) Short entity name 2) Full entity name 3) Relative link to the entity file from the root directory of the project 4) Page title ( title ) 5) Template key ( BreadcrumbsHelper::getTemplateLinkKey() ) 6) Relative reference to the entity document from the root directory of the documentation | |
| PageLinkerPlugin | any | Adds URLs to empty links in HTML format; Links may contain: 1) Short entity name 2) Full entity name 3) Relative link to the entity file from the root directory of the project 4) Page title ( title ) 5) Template key ( BreadcrumbsHelper::getTemplateLinkKey() ) 6) Relative reference to the entity document from the root directory of the documentation | |
| PageRstLinkerPlugin | any | Adds URLs to empty links in rst format; Links may contain: 1) Short entity name 2) Full entity name 3) Relative link to the entity file from the root directory of the project 4) Page title ( title ) 5) Template key ( BreadcrumbsHelper::getTemplateLinkKey() ) 6) Relative reference to the entity document from the root directory of the documentation | |
| BasePhpStubberPlugin | PHP | Adding links to type documentation and documentation of built-in PHP classes | |
| PhpDocumentorStubberPlugin | PHP | Adding links to the documentation of PHP classes in the \phpDocumentor namespace | |
| PhpUnitStubberPlugin | PHP | Adding links to the documentation of PHP classes in the \PHPUnit namespace | |
| StubberPlugin | PHP | The plugin allows you to automatically provide links to github repositories for documented classes from libraries included in composer | |
| EntityDocUnifiedPlacePlugin | PHP | This plugin changes the algorithm for saving entity documents. The standard system stores each file in a directory next to the file where it was requested. This behavior changes and all documents are saved in a separate directory structure, so they are not duplicated. |
- OnLoadSourceLocatorsCollection - Called when source locators are loaded
- AfterRenderingEntities - Event is the base class for classes containing event data.
- BeforeCreatingDocFile - Called before the content of the documentation document is saved to a file
- BeforeRenderingDocFiles - The event occurs before the main documents begin rendering
- BeforeRenderingEntities - The event occurs before the rendering of entity documents begins, after the main documents have been created
- OnCreateDocumentedEntityWrapper - The event occurs when an entity is added to the list for documentation
- OnGetProjectTemplatesDirs - This event occurs when all directories containing document templates are retrieved
- OnGetTemplatePathByRelativeDocPath - The event occurs when the path to the template file is obtained relative to the path to the document
- OnGettingResourceLink - Event occurs when a reference to an entity (resource) is received
- OnLoadEntityDocPluginContent - Called when entity documentation is generated (plugin content loading)
- OnCheckIsClassEntityCanBeLoad - Event is the base class for classes containing event data.
- AfterLoadingClassEntityCollection - The event is called after the initial creation of a collection of class entities
- OnAddClassEntityToCollection - Called when each class entity is added to the entity collection
If you decide to add a new plugin, there are a few things you need to do:
namespace Demo\Plugin\DemoFakeResourceLinkPlugin;
final class DemoFakeResourceLinkPlugin implements \BumbleDocGen\Core\Plugin\PluginInterface
{
public static function getSubscribedEvents(): array
{
return [
\BumbleDocGen\Core\Plugin\Event\Renderer\OnGettingResourceLink::class => 'onGettingResourceLink',
];
}
public function onGettingResourceLink(OnGettingResourceLink $event): void
{
if (!$event->getResourceUrl()) {
$event->setResourceUrl("https://google.com");
}
}
}
plugins:
- class: \Demo\Plugin\DemoFakeResourceLinkPlugin\DemoFakeResourceLinkPluginLast page committer: fshcherbanich <filipp.shcherbanich@team.bumble.com>
Last modified date: Sat Oct 28 11:03:31 2023 +0300
Page content update date: Mon Nov 06 2023
Made with Bumble Documentation Generator