Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prauga FlexDoc for PHP

prauga/flexdoc 0.1.0 provides a framework-neutral PHP 8.2+ host for the canonical FlexDoc renderer, plus thin Laravel and Symfony integrations. It is self-hosted and does not require a runtime CDN.

The canonical source remains in the FlexDoc monorepo. Prauga/flexdoc-php is the Composer/Packagist distribution repository and is synchronized automatically from this package directory.

Generic PHP

use Prauga\FlexDoc\FlexDocConfig;
use Prauga\FlexDoc\FlexDocHost;

$host = new FlexDocHost(new FlexDocConfig(path: '/docs', specUrl: '/openapi.json', title: 'My API'));

Map responseForPath() or the three explicit response methods through your HTTP framework.

Laravel

Laravel package auto-discovery loads FlexDocServiceProvider, which binds FlexDocHost and registers the docs and renderer routes. Configure flexdoc.path, flexdoc.spec_url, flexdoc.title, flexdoc.theme, and flexdoc.try_it_enabled in the application config. FLEXDOC_TRY_IT=false is parsed as a boolean and disables Try It. LaravelFlexDoc::register($router, $host) is also available for manual routing.

Laravel normalizes the request path used for route matching, so the single docs route serves both /docs and /docs/; the package integration tests dispatch both forms explicitly.

Symfony

Register FlexDocHost as a service and inject it into Prauga\FlexDoc\Symfony\FlexDocController. Route /docs, /docs/__flexdoc/renderer.js, and /docs/__flexdoc/renderer.css to the controller's corresponding methods.

Packaging

The package contains the version-matched assets/flexdoc.standalone.{js,css}. PHP CI byte-compares them with packages/client/dist/standalone.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages