Parses a RAML file into a PHP object.
See the RAML spec here: https://github.com/raml-org/raml-spec
Converts JSON schemas into a PHP objects using https://github.com/justinrainbow/json-schema
./composer.phar install --dev
./vendor/bin/phpunit test
$parser = new \Raml\Parser();
$apiDef = $parser->parse($filename, true);
$title = $apiDef->getTitle();
It is possible to export the entire RAML file to an array of the full endpoints. For example, considering a basic RAML, this can be returned using:
$parser = new Raml\Parser();
$api = $parser->parse('test/fixture/simple.raml');
$routes = $api->getResourcesAsUri();
[
GET /songs => ...
POST /songs => ...
GET /songs/{songId} => ...
DELETE /songs/{songId} => ...
]
$routes = $api->getResourcesAsUri(new Raml\Formatters\NoRouteFormatter());
There are two Route Formatters included in this package:
NoRouteFormatter
which does nothing and simply echoes the resultSymfonyRouteFormatter
which adds the routes to a SymfonyRouteCollection
./vendor/bin/phpunit
./vendor/bin/phpunit --coverage-text
./vendor/bin/phpcs --standard=PSR1,PSR2 src
- Make the code prettier
- Add support for the complete raml spec
- SecuredBy
- Markdown?
- Date Representations?
- Validation?
- Parse RAML at URL instead of file?
- Includes
- .yml/.yaml
- .raml/.rml
- .json (parsed using json-schema)
- Display Name
- Traits
- Resource Types