PHPackages                             mnapoli/front-yaml - 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. mnapoli/front-yaml

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

mnapoli/front-yaml
==================

2.0.5(5mo ago)2895.6M—6.3%30[2 PRs](https://github.com/mnapoli/FrontYAML/pulls)20MITPHPPHP ^7.4|^8.0CI passing

Since Jan 24Pushed 5mo ago4 watchersCompare

[ Source](https://github.com/mnapoli/FrontYAML)[ Packagist](https://packagist.org/packages/mnapoli/front-yaml)[ RSS](/packages/mnapoli-front-yaml/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (21)Used By (20)

FrontYAML
=========

[](#frontyaml)

An implementation of YAML Front matter for PHP. It can parse both YAML **and** Markdown.

[![Total Downloads](https://camo.githubusercontent.com/d15beea49662f451faa9f47b29989134b4722b657eb62d4aada7674bcf03fa0e/68747470733a2f2f706f7365722e707567782e6f72672f6d6e61706f6c692f66726f6e742d79616d6c2f646f776e6c6f6164732e737667)](https://packagist.org/packages/mnapoli/front-yaml)

Installation
------------

[](#installation)

Require the project with Composer:

```
composer require mnapoli/front-yaml

```

Usage
-----

[](#usage)

```
$parser = new Mni\FrontYAML\Parser;

$document = $parser->parse($str);

$yaml = $document->getYAML();
$html = $document->getContent();
```

If you don't want the Markdown to be parsed (maybe because it is not Markdown):

```
$document = $parser->parse($str, false);
```

Example
-------

[](#example)

The following file:

```
---
foo: bar
---
This is **strong**.
```

Will give:

```
var_export($document->getYAML());
// array("foo" => "bar")

var_export($document->getContent());
// "This is strong"
```

YAML and Markdown parsers
-------------------------

[](#yaml-and-markdown-parsers)

```
$parser = new Mni\FrontYAML\Parser($yamlParser, $markdownParser);
```

This library uses dependency injection and abstraction to allow you to provide your own YAML or Markdown parser.

```
interface YAMLParser
{
    public function parse($yaml);
}
```

FrontYAML uses by default [Symfony's YAML parser](http://symfony.com/doc/current/components/yaml/introduction.html).

```
interface MarkdownParser
{
    public function parse($markdown);
}
```

FrontYAML uses by default the [League CommonMark parser](https://github.com/thephpleague/commonmark).

###  Health Score

65

—

FairBetter than 99% of packages

Maintenance70

Regular maintenance activity

Popularity62

Solid adoption and visibility

Community38

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 53.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 ~227 days

Recently: every ~383 days

Total

20

Last Release

176d ago

Major Versions

1.8.0 → 2.0.02021-09-11

PHP version history (4 changes)1.6.0PHP &gt;=5.4.0

1.7.0PHP ^7.2

1.8.0PHP &gt;=7.3

2.0.0PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/329a6111724074f5388e95dd41a03ccf3c43f4bfe1ecf27c94c9efc6f7823228?d=identicon)[mnapoli](/maintainers/mnapoli)

---

Top Contributors

[![mnapoli](https://avatars.githubusercontent.com/u/720328?v=4)](https://github.com/mnapoli "mnapoli (44 commits)")[![gmazzap](https://avatars.githubusercontent.com/u/2208282?v=4)](https://github.com/gmazzap "gmazzap (8 commits)")[![tomcoonen](https://avatars.githubusercontent.com/u/988013?v=4)](https://github.com/tomcoonen "tomcoonen (7 commits)")[![clemblanco](https://avatars.githubusercontent.com/u/668419?v=4)](https://github.com/clemblanco "clemblanco (3 commits)")[![jdrieghe](https://avatars.githubusercontent.com/u/12606789?v=4)](https://github.com/jdrieghe "jdrieghe (3 commits)")[![Jibbarth](https://avatars.githubusercontent.com/u/3168281?v=4)](https://github.com/Jibbarth "Jibbarth (3 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (3 commits)")[![benharri](https://avatars.githubusercontent.com/u/7453240?v=4)](https://github.com/benharri "benharri (2 commits)")[![kelunik](https://avatars.githubusercontent.com/u/2743004?v=4)](https://github.com/kelunik "kelunik (2 commits)")[![petk](https://avatars.githubusercontent.com/u/1614009?v=4)](https://github.com/petk "petk (2 commits)")[![wysow](https://avatars.githubusercontent.com/u/632747?v=4)](https://github.com/wysow "wysow (1 commits)")[![settermjd](https://avatars.githubusercontent.com/u/196801?v=4)](https://github.com/settermjd "settermjd (1 commits)")[![petemcfarlane](https://avatars.githubusercontent.com/u/3472717?v=4)](https://github.com/petemcfarlane "petemcfarlane (1 commits)")[![vworldat](https://avatars.githubusercontent.com/u/650955?v=4)](https://github.com/vworldat "vworldat (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

frontmattermarkdownmarkdown-parserphpyaml

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mnapoli-front-yaml/health.svg)

```
[![Health](https://phpackages.com/badges/mnapoli-front-yaml/health.svg)](https://phpackages.com/packages/mnapoli-front-yaml)
```

###  Alternatives

[daux/daux.io

Documentation generator that uses a simple folder structure and Markdown files to create custom documentation on the fly

825191.0k1](/packages/daux-dauxio)[spatie/sheets

Store &amp; retrieve your static content in plain text files

30187.7k4](/packages/spatie-sheets)[prezet/prezet

Prezet: Markdown Blogging for Laravel

2969.8k2](/packages/prezet-prezet)[prohalexey/the-choice

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

Simple Serializer

1914.2k1](/packages/opensoft-simple-serializer)

PHPackages © 2026

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