PHP code example of mrpunyapal / docsmith
1. Go to this page and download the library: Download mrpunyapal/docsmith 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/ */
mrpunyapal / docsmith example snippets
declare(strict_types=1);
h::build(
source: __DIR__ . '/md',
title: 'My Package Docs',
description: 'Documentation generated by Docsmith.',
accentColor: '#ff2d20',
);
declare(strict_types=1);
h::make()
->source(__DIR__ . '/md')
->output(__DIR__ . '/docs')
->title('My Package Docs')
->description('Documentation generated by Docsmith.')
->accentColor('#ff2d20')
->accentColorDark('#ff6b61')
->repositoryUrl('https://github.com/acme/package')
->siteUrl('https://acme.github.io/package')
->editBranch('main')
->rightSidebar()
->baseUrl('/')
->build();
Docsmith::make()
->source(__DIR__ . '/md')
->output(__DIR__ . '/docs')
->customCss('body { background: #fff }') // raw CSS
->build();
Docsmith::make()
->source(__DIR__ . '/md')
->output(__DIR__ . '/docs')
->customCss(__DIR__ . '/my-overrides.css')
->build();
Docsmith::make()
->source(__DIR__ . '/md')
->output(__DIR__ . '/docs')
->favicon('https://example.com/favicon.png')
->build();
Docsmith::make()
->source(__DIR__ . '/md')
->publishMedia(false)
->build();
Docsmith::make()
->source(__DIR__ . '/md')
->title('My Package Docs')
->ogGeneratedAll()
->build();
Docsmith::make()
->source(__DIR__ . '/md')
->title('My Package Docs')
->ogGeneratedPerPage()
->build();
Docsmith::make()
->source(__DIR__ . '/md')
->ogTemplate(__DIR__ . '/og-card.html', scope: 'per-page')
->build();
Docsmith::make()
->source(__DIR__ . '/md')
->ogLink('https://example.com/og/cover.png')
->build();
Docsmith::make()
->source(__DIR__ . '/md')
->ogImage(
type: 'generated',
scope: 'per-page',
template: __DIR__ . '/og-card.html',
scale: 2,
viewport: ['width' => 1200, 'height' => 630],
)
->build();
Docsmith::make()
->ogGeneratedAll()
->captureOg(false)
->build();
Docsmith::make()
->ogGeneratedAll()
->forceOg()
->build();
Docsmith::make()
->readmeIndex(__DIR__ . '/README.md')
->readmeSkipSections(['Contributing', 'Author', 'Notes'])
->title('Repository Docs')
->description('Generated from README index.')
->build();
Docsmith::make()
->source(__DIR__ . '/md')
->output(__DIR__ . '/dist')
->versions([
['slug' => 'v1', 'label' => 'v1.0', 'default' => true],
['slug' => 'v2', 'label' => 'v2.0'],
])
->build();
Docsmith::make()
->output(__DIR__ . '/dist')
->hub([
'package-a' => ['label' => 'Package A', 'source' => __DIR__ . '/md/a'],
'package-b' => ['label' => 'Package B', 'source' => __DIR__ . '/md/b'],
])
->build();
// docsmith.sources.php
return [
[
'repository' => 'https://github.com/laravel/framework.git',
'ref' => '12.x',
'path' => 'docs',
'target' => 'laravel', // materialized to md/laravel
],
];
bash
php build-docs.php
bash
php bin/docsmith sync # fetch remote sources
php bin/docsmith build --sync # or fetch + build in one step