gohiei/api-doc-bundle
gohiei/api-doc-bundle is a PHP package for generating browsable API documentation from your application's routes and annotations. It keeps endpoint references close to the code, making internal or public API docs easier to maintain and share with your team.
Architecture fit — poor, and mismatched at the framework level.
Despite being requested as a Laravel/PHP package, gohiei/api-doc-bundle is a Symfony bundle, not a Laravel package. It is a fork of nelmio/NelmioApiDocBundle, which integrates through Symfony-specific extension points: a Bundle subclass, DependencyInjection compiler passes, HttpKernel event listeners, and Symfony's RouteCollection. Laravel has none of these. There is no ServiceProvider, no Facade, no config/*.php, and no Composer extra.laravel.providers entry, so package auto-discovery will not register anything.
More fundamentally, the package's core value proposition is reading annotations off Symfony controllers and reflecting over the Symfony router to emit an OpenAPI/Swagger document. Laravel's routing (Illuminate\Routing\Route), controller resolution, and middleware pipeline are structurally different. Bridging would mean reimplementing the route-collection adapter and the annotation-reading controller resolver — which is most of the package.
Integration feasibility — low, with a high bridging tax. To make this work inside Laravel you would need to write and own:
Illuminate\Routing\Route to Symfony Route objects for the doc generator,__invoke and resource controller conventions,kernel.event_listener hooks (UI route, asset serving, JSON endpoint).That is a bespoke integration layer with no upstream to track. The realistic effort is days-to-weeks of engineering plus indefinite ownership, for a documentation generator.
Technical risk — high, and concentrated in provenance and abandonment.
NelmioApiDocBundle under a personal account. We cannot tell from the metadata what was changed, whether upstream security fixes were carried forward, or whether the fork is a rename for packagist squatting. This is a supply-chain review item before any code executes in CI.doctrine/annotations, symfony/*, or zircote/swagger-php will not be patched here.Key questions to resolve before any spike:
nelmio/api-doc-bundle v4/v5 directly — this fork adds nothing.)Recommendation: do not adopt. If the stack is Laravel, the functionally equivalent and maintained options are dedoc/scramble (zero-annotation, reflection-based), knuckleswtf/scribe (doc generation plus human-readable output), darkaonline/l5-swagger (Swagger UI + annotations via zircote/swagger-php), or OpenAPI-first with a checked-in spec and spectacle. If the stack is Symfony, use upstream Nelmio.
Stack fit. The package fits only a Symfony 3/4 application on PHP 7.x. It does not fit Laravel at any version. Fit score against a modern Laravel codebase: effectively zero.
Compatibility matrix (inferred from the 2019 release date — verify in a spike):
| Dimension | Likely supported | Modern target | Status |
|---|---|---|---|
| PHP | 7.1 – 7.4 | 8.1 – 8.3 | Incompatible |
| Symfony | 3.4 / 4.x | 5.4 / 6.x / 7.x | Incompatible |
| Laravel | none (not a Laravel package) | 10 / 11 | Not applicable |
| Annotation style | Doctrine annotations | PHP 8 attributes | Legacy |
| Composer install | likely conflicts | — | Expect dependency hell |
Migration path. Two viable routes, neither of which uses this package:
zircote/swagger-php with PHP 8 attributes, wired into Laravel via l5-swagger. Attributes replace annotations one controller at a time, so the migration is incremental and reversible.dedoc/scramble, which requires no annotations at all and derives the spec from Laravel routes, form requests, and API resources. This is the lowest-effort path and the one I would default to.If someone has already written annotations against this bundle's dialect, they are plain OpenAPI annotations and port cleanly to swagger-php — treat the existing annotations as the asset, not the bundle.
Sequencing, if leadership insists on a spike:
composer require and record the conflict graph. Expect failure; the output is the evidence needed to close the question.Do not sequence this as "integrate the bundle, then swap later." The bridging layer is throwaway work that will consume the entire budget before producing a single doc page.
Maintenance. This is the dominant cost. An unmaintained dependency with zero dependents means the adopter becomes the maintainer — of both the package and the Laravel bridge. Every PHP minor upgrade, every Laravel major, and every security advisory in the transitive tree becomes internal work. Contrast with Scramble or l5-swagger, where upstream absorbs that cost. For a documentation tool, that trade is never justified.
Support. No vendor, no community, no issue backlog to search. Internal engineers debugging a reflection failure in a 2019 codebase will be reading source, not docs. Budget for that.
Scaling. Doc generation is a build-time/CI concern rather than a request-path one, but two scaling notes: (a) annotation parsing plus reflection is memory- and CPU-heavy — on a large API surface expect multi-second generation, so cache the output artifact rather than regenerating per request; (b) if the Symfony UI route is exposed in production, it must be behind auth and excluded from public ingress, since the generated spec is an attack-surface map.
Failure modes to expect, ranked by likelihood:
Ramp-up. For a team fluent in Symfony internals, understanding the bundle is a day. For a Laravel team, the ramp-up is not learning the package but learning Symfony's DI and routing well enough to write the bridge — roughly a week before the first useful output, all of it non-transferable. The maintained alternatives have hour-scale ramp-up and Laravel-native mental models.
Bottom line for the operating plan: reject the dependency, reallocate the integration budget to a maintained alternative, and invest the saved effort in CI contract-diff gating — that is where the real durability of an API documentation practice lives, not in the generator.
How can I help you explore Laravel packages today?