PHP code example of hmaus / reynaldo
1. Go to this page and download the library: Download hmaus/reynaldo 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/ */
hmaus / reynaldo example snippets
// load file and json_decode as assoc array into $apiDescription
$parser = new RefractParser();
$parseResult = $parser->parse($apiDescription);
$api = $parseResult->getApi();
// try to get the API title `$api->getApiTitle();`
// or the document description in markdown `$api->getApiDocumentDescription();`
foreach ($parseResult->getApi()->getResourceGroups() as $apiResourceGroup) {
foreach ($apiResourceGroup->getResources() as $apiResource) {
foreach ($apiResource->getTransitions() as $apiStateTransition) {
foreach ($apiStateTransition->getHttpTransactions() as $apiHttpTransaction) {
// inspect `$apiHttpTransaction->getHttpRequest()`, `$apiHttpTransaction->getHttpResponse()`
}
}
}
}