Skip to main content
Core Principle: Single Source of Truth (SSOT)
In Apivalk, your PHP code is the single source of truth. By defining the structure and validation rules of your requests and responses once, you gain:
Automated Validation : Requests are validated against the documentation before reaching your controller.
Type Safety : Input data is automatically cast to the correct PHP types.
IDE Support : DocBlocks are generated to provide autocompletion for request parameters.
OpenAPI Specification : A full OpenAPI 3.0 (Swagger) JSON is generated automatically.
Reusable Components : Standard response objects can be reused across multiple endpoints.
The Documentation Flow
Define : You implement getRequestDocumentation() and getResponseDocumentation() in your controllers using the Property System .
Generate DocBlocks : Use the DocBlockGenerator to create “Shape” classes and update your request classes with @property tags.
Run & Validate : The RequestValidationMiddleware uses your definitions to validate incoming data.
Export : The OpenAPIGenerator crawls your routes and documentation to produce a Swagger file.
Key Subsystems