- Is harmbandstra/swagger-ui-bundle a Laravel package or a Symfony bundle?
- The package is described as a Symfony bundle that integrates Swagger UI and serves its assets from a bundle route. The Laravel-oriented blurb is inconsistent with the overview and TPM assessment, which discuss Symfony routing and bundle configuration. Laravel teams should verify service-provider support before treating it as a native Laravel package.
- How do I install harmbandstra/swagger-ui-bundle with Composer?
- Install it with Composer in a Symfony application and enable the bundle in your kernel or bundles configuration according to the repository instructions. The package serves Swagger UI assets from its own route, so you do not need Node.js or a separate front-end build step. After installation, configure the OpenAPI spec URL and confirm the documentation route renders.
- Does Swagger UI Bundle support Laravel 10 or Laravel 11?
- There is no clear evidence in the provided context that this package provides Laravel service providers, publishable Laravel assets, or Laravel 10/11 compatibility metadata. It is presented as a Symfony bundle, so Laravel 10 or 11 support should not be assumed. Check the repository composer.json and README before adding it to a Laravel application.
- How do I point Swagger UI Bundle at my OpenAPI or Swagger specification?
- Swagger UI Bundle lets you configure the spec URL through bundle configuration, so you can target a generated OpenAPI JSON or YAML endpoint or a static specification file. Point it at a URL that is reachable by the browser loading the docs page. If you use NelmioApiDocBundle, use the docs endpoint it exposes.
- Can I use Swagger UI Bundle with NelmioApiDocBundle?
- Yes. The package is described as compatible with NelmioApiDocBundle and any static OpenAPI JSON or YAML file. A common setup is to let NelmioApiDocBundle generate the specification and configure Swagger UI Bundle to load that endpoint. Verify the generated spec URL and any security restrictions on the docs route.
- Do I need Node.js or a front-end build step to use Swagger UI Bundle?
- No. The bundle serves Swagger UI assets directly from a bundle route, so there is no Node.js requirement or separate asset compilation step. You configure the spec URL, title, and Swagger UI options through bundle configuration. This makes it suitable for PHP-only deployments that need browseable API documentation.
- Can I customize the Swagger UI route and restrict docs to certain environments?
- Yes. The package describes configurable route and asset paths, and it can be restricted per environment using Symfony standard routing and security features. You can also customize the title and Swagger UI options through bundle configuration. In production, protect the docs route with access controls if the API specification should not be public.
- Where should config.json live for Swagger UI Bundle, and will upgrades overwrite it?
- The provided context does not specify an exact config.json location, such as the published assets directory, project root, or another configured path. Because Swagger UI fetches config.json from the browser, confirm which directory the bundle serves and whether vendor asset installation or package upgrades replace it. Keep custom configuration outside vendor-managed published assets where possible and document the chosen location.
- What is the precedence between config.json, bundle config, and environment settings?
- Precedence is governed by Swagger UI and the package initialization code, not by Laravel config cascade. Inline initialization options, environment-driven settings, and config.json may interact in ways that are not obvious, and unknown or invalid keys may only surface in the browser. Test precedence-sensitive settings and check cache headers on the docs page and config.json to avoid stale results.
- Is Swagger UI Bundle safe for production, and what alternatives exist?
- It can be used in production if you restrict the docs route with Symfony security, avoid exposing sensitive OAuth client details in publicly served config.json, and account for the extra browser fetch to config.json in your CSP. Alternatives include NelmioApiDocBundle UI for Symfony and Laravel-focused packages such as L5-Swagger, plus static documentation tools like Redoc. Evaluate the bundled Swagger UI version because supported configuration keys are version-sensitive.