blumilksoftware/openapi-toolbox
Blumilk OpenAPI Toolbox bundles practical tools for Laravel projects using OpenAPI: generate and serve API documentation, validate requests and responses against your spec, and keep schemas in sync with your code.
composer require blumilksoftware/openapi-toolbox
php artisan vendor:publish and select the OpenAPI Toolbox entry, then open the generated config file (typically config/openapi-toolbox.php or similar — confirm the path in the service provider's publishes() method).'documentations' => [
'default' => [
'routes' => [
// route names, prefixes, or middleware groups to include
],
'output' => storage_path('openapi/default.json'),
],
],
php artisan list openapi to see the exact command and options in your installed version, then generate:
php artisan openapi:generate
Where to look first:
php artisan list openapi).docs/ or README section on documentations and caching, since those are the major v3 additions.One documentation per audience. Define separate entries for public, admin, or partner APIs rather than trying to filter one giant spec at consumption time. Generate each independently:
php artisan openapi:generate --documentation=public
php artisan openapi:generate --documentation=admin
Keep output paths distinct and serve each spec from its own docs route or static file.
Generate in CI and diff the artifact. Add a pipeline step that runs generation and fails if the committed spec changes unexpectedly. This turns undocumented endpoint changes into review comments instead of production surprises. Pair it with a validator such as Spectral for linting the generated OpenAPI.
Configure caching deliberately. v3 makes the cache configurable. Set an explicit cache store and TTL per environment rather than relying on defaults. In local development, prefer disabling the cache or using a short TTL so route/attribute changes are reflected immediately. In production, warm the cache during deployment.
Serve docs behind access control. Expose generated documentation through a route or static file, but gate it with middleware in non-local environments. Documentation often reveals internal routes and payload shapes.
Reuse schemas through attributes/components. Define request and response schemas once (attributes, form requests, or shared component definitions) and reference them across endpoints. This keeps generated specs consistent and makes breaking changes visible in one place.
Keep generation close to route definitions. When a route changes, the corresponding attribute or config entry should change in the same PR. Treat the generated file as a build artifact that is either committed intentionally or produced only in CI — pick one policy and enforce it.
composer.json and re-test generation.php artisan route:cache, regenerate documentation after clearing and rebuilding the route cache; stale route caches can produce incomplete specs.$refs and invalid component names before consumers do.How can I help you explore Laravel packages today?