lesname/documentor

0.6.1 2025-05-16 10:52 UTC

README

Les Documentor is a library that helps read sources and transform it to type documents.

Current sources supported:

Example

Value object

use LesDocumentor\Type\ClassPropertiesTypeDocumentor;
use LesValueObject\String\Format\EmailAddress;

$documentor = new ClassPropertiesTypeDocumentor();

$document = $documentor->document(EmailAddress::class);

Result:

StringTypeDocument
- reference: LesValueObject\String\Format\EmailAddress
- description: null
- nullable: false
- length
    - minimal: 5
    - maximal: 255
- format: null
- pattern: null

OpenApi

use LesDocumentor\Type\OpenApiTypeDocumentor;

$documentor = new OpenApiTypeDocumentor();

$document = $documentor->document(
    [
            "type" => "integer",
            "minimum" => 100,
            "maximum" => 600
    ],
);

Result:

NumberTypeDocument
- reference: null
- description: null
- nullable: false
- range
    - minimal: 100
    - maximal 500
- multipleOf: null
- format: null