Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Autodoc Php Laravel Package

421c/autodoc-php

Autodoc-php automatically generates clear API documentation for Laravel and PHP applications by inspecting routes, controllers, and request/response definitions. Reduce manual docs, keep references up to date, and give teams a browsable, searchable overview of endpoints with minimal configuration.

Deep Wiki
Context7

Getting Started

  1. Verify the package before adopting it. The repository is unlisted and the star count is low, so treat the supply chain as unproven. Run composer show 421c/autodoc-php, inspect vendor/421c/autodoc-php/composer.json, the README, and the test suite. Pin an exact version ("421c/autodoc-php": "x.y.z") and commit the lockfile.
  2. Install as a dev dependency — documentation generation belongs in build/CI, not in the production request path: composer require --dev 421c/autodoc-php.
  3. Locate the entry point. Look for a bin entry in composer.json (vendor/bin/...) or, in Laravel, a service provider with an Artisan command. Check extra.laravel.providers for auto-discovery and any publishable config (php artisan vendor:publish --tag=autodoc).
  4. Start with one endpoint, not the whole app. Point the scanner at a single controller or route group. Dynamic route registration, closures, vendor code, and test routes will pollute a full scan on the first run.
  5. Validate immediately. Pipe the output through npx @redocly/cli lint openapi.json (or Spectral). If it doesn't pass OpenAPI 3.1 validation, fix configuration before expanding scope.
  6. Render it. Point Swagger UI, Redoc, or Scalar at the generated file so you get a fast visual feedback loop for what's missing.

First useful outcome: a lint-clean spec for your health check and one CRUD resource, diffed against what you know the API actually returns.

Implementation Patterns

Build-time generation, never request-time. Add a Composer script or Makefile target:

"scripts": { "docs": "autodoc generate --output=docs/openapi.json" }

Run it in CI, upload the artifact, or commit it to a docs branch. Serving it dynamically in development is fine if you cache on file mtimes; serving it per-request in production is not.

Incremental adoption via allowlists. Configure paths / include / exclude so only annotated namespaces are scanned, then expand coverage one PR at a time. Use an allowlist rather than a blocklist — blocklists leak internal endpoints into public specs.

Let code be the source of truth, annotate the gaps. Expect the generator to infer from type hints, return types, FormRequest rules, API Resources, and backed enums. Where it can't (unions, array shapes, generics like Collection<int, User>), supply attributes/docblocks or a manual override file that is merged after generation.

Treat the spec as a contract artifact. Generate → lint → oasdiff against main's spec → fail the build on breaking changes for public endpoints. Optionally feed the spec to Schemathesis or Dredd for contract tests.

One spec per bounded context in a monolith, with servers and tags distinguishing modules. This keeps diffs reviewable and avoids one giant contested file.

Define shared components once. Security schemes, 401/403/422/500 responses, pagination envelopes, and error shapes should live in a config-level components block or a base spec that gets merged, not repeated per endpoint.

Register customization through the package's extension points (type mappers, schema-name resolvers, attribute readers, post-processing hooks) rather than editing generated output. Keep overrides in source-controlled files so regeneration never clobbers them.

Gotchas and Tips

  • OpenAPI 3.1 tooling is uneven. Nullable types become type: ["string", "null"], examples is an array, and schemas follow JSON Schema 2020-12. Older Swagger UI builds and some validators reject this. Confirm your renderer supports 3.1 before blaming the generator.
  • Reflection has hard limits. Union/intersection return types, generics in docblocks, mixed, array shapes, and conditional returns will need manual annotation. Budget for this; it is the main ongoing cost.
  • Route discovery requires bootstrapping. Routes that touch the database, network, or service container at registration time can break generation. Avoid closures without serializable reflection, and exclude vendor/test routes explicitly.
  • Recursive models cause infinite loops or duplicated inline schemas. Enforce $ref and a deterministic schema-naming strategy; check the config for cycle handling.
  • Auth and error responses are invisible by default. They must be declared. Map middleware to security requirements in config so the spec matches runtime behavior.
  • Enums: distinguish backed from unit enums and verify how descriptions and case names are emitted; this is a common source of drift.
  • Don't leak internals. Audit the generated file for admin routes, debug endpoints, and internal hostnames before publishing the artifact.
  • Debug by bisection. Generate one route at a time with a verbose flag, diff against expected JSON, and validate at each step. Compare the emitted schema for a known model against its PHP class to spot inference gaps.
  • Low adoption means no community answers. The tests are your real documentation — read them for canonical option names and expected behavior.
  • Release metadata is suspicious (a 2026-10-15 release date). Verify the tag and commit provenance, or pin to a specific commit hash, before trusting it in CI.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource