Download the PHP package andrii-hrechyn/auto-documentation without Composer
On this page you can find all versions of the php package andrii-hrechyn/auto-documentation. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download andrii-hrechyn/auto-documentation
More information about andrii-hrechyn/auto-documentation
Files in andrii-hrechyn/auto-documentation
Package auto-documentation
Short Description Auto generated documentation for laravel
License MIT
Informations about the package auto-documentation
Auto Documentation
Generate OpenAPI 3.1 documentation for Laravel APIs with fluent PHP builders, rendered with Redoc.
The typical endpoint is one chain:
The URI, HTTP verb, {path} parameters, operationId, tag and the auth hint all come from your named Laravel route — you never describe what the framework already knows.
Requirements
- PHP 8.2+
- Laravel 11 or 12
Installation
The install command creates a docs/ folder (autoloaded as Docs\) with working examples:
Describing your API
Documentation files return values — no global state:
docs/info.phpreturns a configuredAutoDocbuilder;- every file in
docs/Paths/returns an array ofPathobjects.
Route-first (recommended)
Explicit composition
Every shortcut expands into the same explicit object graph, which is always available:
Schemas
Full JSON Schema 2020-12 core: type unions (->nullable()), oneOf/anyOf/allOf/not with discriminators, additionalProperties, const, pattern, numeric and length constraints:
Or infer a response schema from a real payload — the example is attached automatically and all keys become required:
Reusable schemas, parameters and responses extend the classes in AutoDocumentation\Components and are emitted under components with $ref automatically. Presets ship for common responses: UnauthorizedResponse (401), ForbiddenResponse (403), ValidationErrorResponse (422, Laravel error shape).
For API Resources, the recommended convention is one SchemaComponent per resource, referenced from every endpoint that returns it — the contract test below keeps the component honest against the real output.
Custom validation rules
fromFormRequest() maps standard Laravel rules out of the box. Register mappers for your own rules — by class for Rule objects, by name for string rules (rule arguments arrive in the matched string):
A matched extension owns the field's schema; required and nullable handling still applies on top.
Generating and serving
The Redoc UI is served at /api/doc (spec at /api/doc/spec) in the environments listed in the config. Set AUTO_DOCUMENTATION_GENERATE_ALWAYS=true locally to regenerate on every page load. Publish the config with:
Keeping the documentation honest
Lint the spec structurally (missing responses, parameter/URI mismatches, dangling $refs, unregistered security schemes and more):
Contract-test real responses against the documentation in your feature tests:
A response that drifts from its documented schema — wrong type, missing required field, undocumented status — fails the test with a field-level diff.
Testing
License
This library is licensed under the MIT License. See the LICENSE file for details.
Credits
- Developer: Andriy Hrechyn
- Email: [email protected]
All versions of auto-documentation with dependencies
illuminate/support Version ^11.0|^12.0
symfony/process Version ^7.0
symfony/yaml Version ^7.0