giansalex / swagger-objects
PHP Object to Swagger Definitions
v1.1.1
2023-01-13 17:10 UTC
Requires
- php: >=7.4
- phpdocumentor/reflection-docblock: ^5.3
- symfony/property-info: ^5.4
README
PHP Objects to Swagger Definitions.
Install
Via Composer from packagist.org.
composer require giansalex/swagger-objects
Php object
class Document { /** * @var string */ private $tipoDoc; /** * @var string */ private $nroDoc; /** * @return string */ public function getTipoDoc() { return $this->tipoDoc; } /** * @param string $tipoDoc * @return Document */ public function setTipoDoc($tipoDoc) { $this->tipoDoc = $tipoDoc; return $this; } /** * @return string */ public function getNroDoc() { return $this->nroDoc; } /** * @param string $nroDoc * @return Document */ public function setNroDoc($nroDoc) { $this->nroDoc = $nroDoc; return $this; } }
Usage
$swagger = new Swagger(); $result = $swagger->fromClass(Document::class); var_dump();
Result
[ 'definitions' => [ 'Document' => [ 'type' => 'object', 'properties' => [ 'tipoDoc' => [ 'type' => 'string' ], 'nroDoc' => [ 'type' => 'string' ] ] ] ] ]