PHP code example of marko / docs

1. Go to this page and download the library: Download marko/docs 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/ */

    

marko / docs example snippets


use Marko\Docs\Contract\DocsSearchInterface;
use Marko\Docs\ValueObject\DocsQuery;

class DocsController
{
    public function __construct(
        private DocsSearchInterface $docs,
    ) {}

    public function search(string $term): array
    {
        return $this->docs->search(new DocsQuery($term, limit: 10));
    }
}

#[Preference(DocsSearchInterface::class)]
class MyDocsSearch implements DocsSearchInterface
{
    public function search(DocsQuery $query): array { /* ... */ }
    public function getPage(string $id): DocsPage { /* ... */ }
    public function listNav(): array { /* ... */ }
    public function driverName(): string { return 'custom'; }
}