Search by

ez-php / swagger-ui

AU9500

Serves Swagger UI / ReDoc documentation for the OpenAPI spec produced by ez-php/openapi

Package info

github.com/ez-php/swagger-ui

pkg:composer/ez-php/swagger-ui

Statistics

Installs: 28

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.5.6 2026-09-30 18:37 UTC

README

Serves Swagger UI / ReDoc documentation for the OpenAPI spec produced by ez-php/openapi

Installation

composer require ez-php/swagger-ui

Usage

Register the service provider (typically in provider/modules.php):

$app->register(\EzPhp\SwaggerUI\SwaggerUiServiceProvider::class);

This registers GET /docs, rendering a Swagger UI page that fetches its spec from GET /openapi.json (see ez-php/openapi). Configure via config/swagger-ui.php or environment:

return [
    'endpoint' => getenv('SWAGGER_UI_ENDPOINT') ?: '/docs',
    'spec_url' => getenv('SWAGGER_UI_SPEC_URL') ?: '/openapi.json',
    'renderer' => getenv('SWAGGER_UI_RENDERER') ?: 'swagger-ui', // or 'redoc'
];

Both renderers load their assets from a CDN (jsDelivr), pinned to exact versions (swagger-ui-dist@5.33.0, redoc@2.5.4) with Subresource Integrity hashes — nothing is vendored by this module. Apply authentication or rate limiting to the /docs route in your own application's service provider if the documentation should not be publicly accessible.

License

MIT