PHP code example of raml-org / raml-php-parser

1. Go to this page and download the library: Download raml-org/raml-php-parser 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/ */

    

raml-org / raml-php-parser example snippets


$parser = new \Raml\Parser();
$apiDef = $parser->parse($filename, true);

$title = $apiDef->getTitle();

$parser = new \Raml\Parser();
$api = $parser->parse('tests/fixture/simple.raml');

$routes = $api->getResourcesAsUri();

[
    GET /songs => ...
    POST /songs => ...
    GET /songs/{songId} => ...
    DELETE /songs/{songId} => ...
]

$routes = $api->getResourcesAsUri(new \Raml\RouteFormatter\NoRouteFormatter());