PHPackages                             cozylife/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. cozylife/php-raml-parser

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

cozylife/php-raml-parser
========================

A RAML parser built in php

1.0.0(11y ago)235MITPHP

Since Jun 26Pushed 10y ago1 watchersCompare

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

READMEChangelogDependencies (7)Versions (27)Used By (0)

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

[](#php-raml-parser)

Parses a RAML file into a PHP object.

See the RAML spec here:

Differences in this fork
========================

[](#differences-in-this-fork)

The [original release](https://github.com/alecsammon/php-raml-parser) of PHP RAML Parser merges the call data for each security call with the main request. That causes unnecessary overhead when, for example, requesting OAuth tokens, and can create unintended side-effects. This fork remedies that issue by keeping all calls independent.

See more about why [this change](https://github.com/alecsammon/php-raml-parser/pull/70#issuecomment-100929712) is critical when making calls based on an API modeling language.

### 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

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 69.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 ~16 days

Recently: every ~28 days

Total

26

Last Release

3927d ago

Major Versions

0.6.3 → 1.0.02015-03-26

1.3.2.x-dev → 2.0.0.x-dev2015-08-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/3dc3bf254061004028289ba205a02948c18e9aad6c5c584d4d7bbbc4e06f0d53?d=identicon)[CozyLife](/maintainers/CozyLife)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/cozylife-php-raml-parser/health.svg)](https://phpackages.com/packages/cozylife-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)
