Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hendrikmaus/reynaldo
Turn API Blueprint Refract Parse Result (Drafter's output) into a traversable PHP data structure.
https://github.com/hendrikmaus/reynaldo
Last synced: 12 days ago
JSON representation
Turn API Blueprint Refract Parse Result (Drafter's output) into a traversable PHP data structure.
- Host: GitHub
- URL: https://github.com/hendrikmaus/reynaldo
- Owner: hendrikmaus
- License: mit
- Created: 2016-08-29T14:03:28.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2021-05-09T13:03:02.000Z (over 3 years ago)
- Last Synced: 2024-10-26T16:54:40.411Z (19 days ago)
- Language: PHP
- Size: 141 KB
- Stars: 6
- Watchers: 6
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Reynaldo
Turn API Blueprint Refract Parse Result (Drafter's output) into a traversable PHP data structure.[![codecov.io](http://codecov.io/github/hendrikmaus/reynaldo/coverage.svg?branch=master)](http://codecov.io/github/hendrikmaus/reynaldo?branch=master)
[![Code Climate](https://img.shields.io/codeclimate/github/kabisaict/flow.svg)](https://codeclimate.com/github/hendrikmaus/reynaldo)## What is Reynaldo?
It should ease the processing of [Drafter](https://github.com/apiaryio/drafter) refract output.
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`.Out comes an easily traversable object.
You can find a little example in `/example`.
```php
// 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](https://getcomposer.org):
```bash
$ composer require hmaus/reynaldo
```This will install the PHP package with your application.
## License
Reynaldo is licensed under the MIT License - see the
[LICENSE](https://github.com/hendrikmaus/reynaldo/blob/master/LICENSE) file for details.