Replace L5-Swagger's Default UI in Laravel
The two common ways Laravel projects generate API docs — darkaonline/l5-swagger (annotation-based,
wraps Swagger UI in a Blade view) and Scribe (doc-block based, exports a static OpenAPI file) — both
already do the hard part of building the spec. Only the viewer sitting on top is worth swapping out.
L5-Swagger
L5-Swagger writes its generated document to disk (php artisan l5-swagger:generate) and serves it at a
JSON route controlled by config/l5-swagger.php — by default that resolves to /docs/api-docs.json,
separate from the Blade-rendered UI route at /api/documentation.
You don’t need to touch L5-Swagger’s own routes or config to replace the UI — just stop linking to
/api/documentation and add your own route pointing at the same JSON file:
// routes/web.php
Route::get('/api-docs', function () {
return response(<<<HTML
<div id="api-docs" style="height: 100vh"></div>
<script src="https://cdn.getman.dev/latest/getman-ui.js"></script>
<script>
GetMan.launch(document.getElementById('api-docs'), { url: '/docs/api-docs.json' });
</script>
HTML)->header('Content-Type', 'text/html');
});
If your l5-swagger.php config customizes routes.docs or paths.docs_json, update the url above to
match whatever path they resolve to.
Scribe
Scribe’s OpenAPI export writes to a static file — commonly published under public/docs/openapi.yaml —
rather than serving it from a live route. Check config/scribe.php for where yours lands, then point
GetMan at it directly; it reads YAML specs the same way it reads JSON, so no conversion step is needed:
// routes/web.php
Route::get('/api-docs', function () {
return response(<<<HTML
<div id="api-docs" style="height: 100vh"></div>
<script src="https://cdn.getman.dev/latest/getman-ui.js"></script>
<script>
GetMan.launch(document.getElementById('api-docs'), { url: '/docs/openapi.yaml' });
</script>
HTML)->header('Content-Type', 'text/html');
});
Either way, re-run your generator (l5-swagger:generate or scribe:generate) whenever routes change —
GetMan is only ever as current as the file it’s pointed at.
L5-Swagger’s Blade view wraps Swagger UI specifically — see the Swagger UI alternative comparison for what changes feature-wise once GetMan replaces it.
Try it with your own spec
Paste any OpenAPI or Swagger URL and see it rendered live — no signup, no install.
Open the explorer