- How do I install Docsmith in a Laravel project?
- Install it as a dev dependency with composer require --dev mrpunyapal/docsmith. Then create a small build script that requires vendor/autoload.php and calls Docsmith::build() with your Markdown source directory and site title. Running php build-docs.php writes the generated static HTML site into a docs folder by default.
- Is Docsmith a Laravel package or is it framework-agnostic?
- Docsmith is framework-agnostic and CLI-driven, so it does not ship a service provider, config file, or Eloquent integration. It is installed through Composer and requires PHP 8.1+, which lines up with Laravel 9 and 10+. Laravel projects use it to generate docs and then serve the static output however they prefer.
- How do I serve Docsmith docs at /docs inside a Laravel application?
- Build the site into a static folder, then either copy it to public/docs or register a route such as Route::get('docs/{path}', [DocController::class, 'serve']) with a controller that returns the matching HTML file. You can wrap that route with Laravel middleware like auth, throttle, or localization. Because the output is plain HTML, you never need database or queue access at request time.
- Does Docsmith include search?
- Yes, it generates a search-index.json file that powers global search results in the default UI, alongside searchable sidebar navigation. There is no built-in Algolia or Meilisearch integration, so if you need hosted search you would add it yourself. For most package and project docs the generated index is enough.
- Can I deploy Docsmith docs to GitHub Pages?
- Yes, GitHub Pages is the intended workflow and the default output folder is docs. Docsmith also generates a sitemap.xml and a .nojekyll file automatically so assets are served correctly. Point your Pages settings at the docs directory or push the built output from CI.
- How do I customize the accent color and layout of Docsmith docs?
- You can set accentColor and accentColorDark at build time, and Docsmith derives the softer hover and focus shades from your accent hex value. The fluent API also exposes options like rightSidebar() for a table of contents, baseUrl(), repositoryUrl(), siteUrl(), and editBranch() for repository and edit links. An optional README index compatibility mode helps existing repositories adopt the tool.
- Can I use Docsmith for private documentation behind authentication?
- Docsmith itself produces static files, so it has no authentication layer of its own. In a Laravel app you can gate the docs route with middleware such as auth or a custom SSO check, or host the static site behind an OAuth2 proxy. Alternatively, keep the docs internal and deploy them to a private static host.
- Which PHP and Laravel versions does Docsmith support?
- Docsmith requires PHP 8.1 or newer, which aligns with Laravel 9 and 10 and later releases. It is installed with Composer like any other dependency and has no Node.js or JS bundler requirement. Check the Packagist page and CI badge for the latest supported version range.
- How do I keep Docsmith documentation rebuilt automatically?
- Docsmith is a build-time tool, so rebuilds are triggered by your own pipeline rather than a running server. Common approaches are a GitHub Actions workflow that runs the build script on pushes to main, or a scheduled Laravel command for internal docs. There is no real-time preview like Docusaurus, so local rebuilds are the usual way to review changes.
- How does Docsmith compare to Docusaurus or other documentation generators?
- The main difference is zero frontend setup: no Node.js install and no JS bundler, just a Composer package and a short PHP build script. You get syntax-highlighted code with copy buttons, collapsible grouped navigation, an optional table of contents, and generated search index, sitemap, and .nojekyll files. The tradeoffs are no live dev server preview and no native Laravel ecosystem features such as queues or Eloquent.