2017 © Pedro Peláez
 

library reynaldo

Parse API Blueprint refract into a iterable PHP data structure for easier access

image

hmaus/reynaldo

Parse API Blueprint refract into a iterable PHP data structure for easier access

  • Friday, July 20, 2018
  • by hendrikmaus
  • Repository
  • 5 Watchers
  • 4 Stars
  • 2,818 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 5 Forks
  • 2 Open issues
  • 6 Versions
  • 21 % Grown

The README.md

Reynaldo

Turn API Blueprint Refract Parse Result (Drafter's output) into a traversable PHP data structure., (*1)

codecov.io Code Climate, (*2)

What is Reynaldo?

It should ease the processing of Drafter refract output., (*3)

You read your Drafter parse result, either JSON or YAML, you convert that to a PHP assoc array, e.g. json_decode($parseresult, true) in PHP and pass it into \Hmaus\Reynaldo\Parser\RefractParser::parse., (*4)

Out comes an easily traversable object., (*5)

You can find a little example in /example., (*6)

// 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()`
            }
        }
    }
}

Requirements

  • PHP 7.0 or greater

Installation

The recommended way to install is by using composer:, (*7)

$ composer require hmaus/reynaldo

This will install the PHP package with your application., (*8)

License

Reynaldo is licensed under the MIT License - see the LICENSE file for details., (*9)

The Versions

20/07 2018

dev-master

9999999-dev

Parse API Blueprint refract into a iterable PHP data structure for easier access

  Sources   Download

MIT

The Development Requires

by Hendrik Maus

20/07 2018

v0.1.4

0.1.4.0

Parse API Blueprint refract into a iterable PHP data structure for easier access

  Sources   Download

MIT

The Development Requires

by Hendrik Maus

04/10 2017

v0.1.3

0.1.3.0

Parse API Blueprint refract into a iterable PHP data structure for easier access

  Sources   Download

MIT

The Development Requires

by Hendrik Maus

04/09 2016

v0.1.2

0.1.2.0

Parse API Blueprint refract into a iterable PHP data structure for easier access

  Sources   Download

MIT

The Development Requires

by Hendrik Maus

01/09 2016

v0.1.1

0.1.1.0

Parse API Blueprint refract into a iterable PHP data structure for easier access

  Sources   Download

MIT

The Development Requires

by Hendrik Maus

30/08 2016

v0.1.0

0.1.0.0

Parse API Blueprint refract into a iterable PHP data structure for easier access

  Sources   Download

MIT

The Development Requires

by Hendrik Maus