PHP code example of giansalex / swagger-objects

1. Go to this page and download the library: Download giansalex/swagger-objects library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

giansalex / swagger-objects example snippets


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;
    }
}

$swagger = new Swagger();
$result = $swagger->fromClass(Document::class);

var_dump();

[
'definitions' => [
    'Document' => [
        'type' => 'object',
        'properties' => [
            'tipoDoc' => [
                'type' => 'string'
            ],
            'nroDoc' => [
                'type' => 'string'
            ]
        ]
    ]
  ]
]