PHPackages                             cnam/php-raml-parser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. cnam/php-raml-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

cnam/php-raml-parser
====================

A RAML parser built in php

1.0.8(10y ago)11.2k21MITPHP

Since Jun 26Pushed 10y ago1 watchersCompare

[ Source](https://github.com/cnam/php-raml-parser)[ Packagist](https://packagist.org/packages/cnam/php-raml-parser)[ Docs](https://github.com/alecsammon/php-raml-parser)[ RSS](/packages/cnam-php-raml-parser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (29)Used By (1)

PHP RAML Parser
===============

[](#php-raml-parser)

Parses a RAML file into a PHP object.

[![Build Status](https://camo.githubusercontent.com/8b40cf10e6010e33759441d1ecc52e91b7068acb271fb1228a21056bab501512/68747470733a2f2f7472617669732d63692e6f72672f616c656373616d6d6f6e2f7068702d72616d6c2d7061727365722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/alecsammon/php-raml-parser)[![Coverage Status](https://camo.githubusercontent.com/d3295898775ab33275617aa93504c81bc3af45057155a53cbe244f40b129da05/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f616c656373616d6d6f6e2f7068702d72616d6c2d7061727365722e737667)](https://coveralls.io/r/alecsammon/php-raml-parser?branch=master)[![HHVM Status](https://camo.githubusercontent.com/09fce7517844a1fa9fe42a5a588a19a1c324a68cde2ef9a8679af22039e5ec6c/687474703a2f2f6868766d2e683463632e64652f62616467652f616c656373616d6d6f6e2f7068702d72616d6c2d7061727365722e706e67)](http://hhvm.h4cc.de/package/alecsammon/php-raml-parser)

See the RAML spec here:

### Get started

[](#get-started)

Requires:

- composer (see )

```
composer install --dev
./vendor/bin/phpunit test
```

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

$title = $apiDef->getTitle();
```

### Parsing schemas

[](#parsing-schemas)

The library can convert schemas into an validation object. There is a default list, or they can be configured manually. Each schema parser needs to conform to `\Raml\Schema\SchemaParserInterface` and will return a instance of `\Raml\Schema\SchemaDefinitionInterface`.

Additional parsers and schema definitions can be created and passed into the `\Raml\Parser` constructor

### Exporting routes

[](#exporting-routes)

It is also possible to export the entire RAML file to an array of the full endpoints. For example, considering a [basic RAML](https://github.com/alecsammon/php-raml-parser/blob/master/test/fixture/simple.raml), this can be returned using:

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

$routes = $api->getResourcesAsUri();
```

To return:

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

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

#### Route Formatters

[](#route-formatters)

There are two Route Formatters included in this package:

- `NoRouteFormatter` which does nothing and simply echoes the result
- `SymfonyRouteFormatter` which adds the routes to a Symfony `RouteCollection`

### Contributing

[](#contributing)

```
./vendor/bin/phpunit
./vendor/bin/phpunit --coverage-text
./vendor/bin/phpcs --standard=PSR1,PSR2 src
```

### TODO

[](#todo)

- Documentation/Markdown parser
- Date Representations?
- Parse RAML at provided URL

### Supported (I Believe)

[](#supported-i-believe)

- Includes
    - .yml/.yaml
    - .raml/.rml
    - .json (parsed using json-schema)
- Display Name
- Traits
- Resource Types

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~13 days

Total

27

Last Release

4002d ago

Major Versions

0.6.3 → 1.0.02015-03-26

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1832776?v=4)[Anton Cnam](/maintainers/cnam)[@cnam](https://github.com/cnam)

---

Top Contributors

[![alecsammon](https://avatars.githubusercontent.com/u/304636?v=4)](https://github.com/alecsammon "alecsammon (90 commits)")[![qpautrat](https://avatars.githubusercontent.com/u/1844413?v=4)](https://github.com/qpautrat "qpautrat (20 commits)")[![cnam](https://avatars.githubusercontent.com/u/1832776?v=4)](https://github.com/cnam "cnam (9 commits)")[![Toflar](https://avatars.githubusercontent.com/u/481937?v=4)](https://github.com/Toflar "Toflar (5 commits)")[![titomiguelcosta](https://avatars.githubusercontent.com/u/192639?v=4)](https://github.com/titomiguelcosta "titomiguelcosta (3 commits)")[![h4cc](https://avatars.githubusercontent.com/u/2981491?v=4)](https://github.com/h4cc "h4cc (3 commits)")[![nacmartin](https://avatars.githubusercontent.com/u/154258?v=4)](https://github.com/nacmartin "nacmartin (1 commits)")[![darh](https://avatars.githubusercontent.com/u/1500447?v=4)](https://github.com/darh "darh (1 commits)")[![cozylife](https://avatars.githubusercontent.com/u/81341241?v=4)](https://github.com/cozylife "cozylife (1 commits)")[![Philzen](https://avatars.githubusercontent.com/u/1634615?v=4)](https://github.com/Philzen "Philzen (1 commits)")[![jeromemacias](https://avatars.githubusercontent.com/u/582446?v=4)](https://github.com/jeromemacias "jeromemacias (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/cnam-php-raml-parser/health.svg)

```
[![Health](https://phpackages.com/badges/cnam-php-raml-parser/health.svg)](https://phpackages.com/packages/cnam-php-raml-parser)
```

###  Alternatives

[wikimedia/parsoid

Parsoid, a bidirectional parser between wikitext and HTML5

171524.3k1](/packages/wikimedia-parsoid)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[netgen/layouts-core

Netgen Layouts enables you to build and manage complex web pages in a simpler way and with less coding. This is the core of Netgen Layouts, its heart and soul.

3689.4k10](/packages/netgen-layouts-core)[prohalexey/the-choice

253.3k](/packages/prohalexey-the-choice)[opensoft/simple-serializer

Simple Serializer

1914.2k1](/packages/opensoft-simple-serializer)[jms/serializer-service-provider

Silex Service Provider for the Serializer Bundle

117.9k2](/packages/jms-serializer-service-provider)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
