prauga / flexdoc
Self-hosted FlexDoc OpenAPI renderer integration for PHP, Laravel, and Symfony
Requires
- php: >=8.2
Requires (Dev)
- illuminate/config: ^11.0 || ^12.0
- illuminate/container: ^11.0 || ^12.0
- illuminate/events: ^11.0 || ^12.0
- illuminate/http: ^11.0 || ^12.0
- illuminate/routing: ^11.0 || ^12.0
- illuminate/support: ^11.0 || ^12.0
- symfony/http-foundation: ^7.2
Suggests
- illuminate/routing: Required for the Laravel integration
- illuminate/support: Required for Laravel service-provider auto-discovery
- symfony/http-foundation: Required for the Symfony controller integration
Provides
None
Conflicts
None
Replaces
None
README
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.