PHP code example of lin3s / knowledge-base

1. Go to this page and download the library: Download lin3s/knowledge-base library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lin3s / knowledge-base example snippets




IN3S\KnowledgeBase\Configuration;
use LIN3S\KnowledgeBase\Controller\PageController;
use LIN3S\KnowledgeBaseGFMTemplate\Template;
use Symfony\Component\HttpFoundation\Request;

$buildPath = realpath(dirname(__FILE__)) . '/build'; // Folder where all the cached files will be stored
$docsPath = realpath(dirname(__FILE__)) . '/docs';   // Folder where all the docs are located

$configuration = new Configuration($docsPath, $buildPath, new Template());
$controller = new PageController($configuration);

$request = Request::createFromGlobals();

if (preg_match('/\.(?:png|jpg|jpeg|gif|css|js)$/', $request->server->get('REQUEST_URI'))) {
    $response = $controller->assetAction($request);
} else {
    $response = $controller->documentAction($request);
}
$response->send();

#!/usr/bin/env php


Configuration;
use LIN3S\KnowledgeBaseGFMTemplate\Template;
use LIN3S\KnowledgeBase\Registry\GeneratorRegistry;
use LIN3S\KnowledgeBase\Generator\HTMLGenerator;
use LIN3S\KnowledgeBase\Generator\MenuGenerator;
use LIN3S\KnowledgeBase\Builder\DocumentationBuilder;
use LIN3S\KnowledgeBase\Iterator\DocumentIterator;

$docsPath = realpath(dirname(__FILE__)) . '/../docs';
$buildPath = realpath(dirname(__FILE__)) . '/../build';

$configuration = new Configuration($docsPath, $buildPath, new Template());

$generatorRegistry = new GeneratorRegistry();
$generatorRegistry
    ->add('html', new HTMLGenerator($this->configuration))
    ->add('route', new MenuGenerator($this->configuration));

$builder = new DocumentationBuilder(
    new DocumentIterator($this->configuration),
    $generatorRegistry
);

$builder->build();
shell
$ php docs.php