PHP code example of goez / apib-unit

1. Go to this page and download the library: Download goez/apib-unit 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/ */

    

goez / apib-unit example snippets


// Parse API-Blueprint document, and get the endpoints.
$endpoints = (new Apib('./example.apib'))->getEndpoints();

// Get first endpoints
$endpoint = $endpoints[0];

// Get first example of the endpoint
$example = $endpoint->getExamples()[0];

// Get request of example
$request = $example->getRequests()[0];

// Get response of example
$response = $example->getResponse()[0];

// Get JSON Schema of response
$schema = $response->getSchema();