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

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

modularr/yaml-front-matter
==========================

YAML-FrontMatter is a simple to use PHP-only FrontMatter type parser Library.

1.0.0(8y ago)345675MITPHPCI failing

Since Apr 5Pushed 5y ago3 watchersCompare

[ Source](https://github.com/Modularr/YAML-FrontMatter)[ Packagist](https://packagist.org/packages/modularr/yaml-front-matter)[ RSS](/packages/modularr-yaml-front-matter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

YAML Front Matter
=================

[](#yaml-front-matter)

[![Latest Version](https://camo.githubusercontent.com/b9c6dbfd037177266e1c9b8f03506a59d095a6bb2839893dfe4fd6d87912c96c/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f64756c6172722f79616d6c2d66726f6e742d6d61747465722e7376673f7374796c653d666c6174)](https://packagist.org/packages/modularr/yaml-front-matter)[![Software License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![Build Status](https://camo.githubusercontent.com/69339b3221ef5ac9b38f29bcfb6af97724f6b5199f9149b2f4e79e945ef1912f/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4d6f64756c6172722f59414d4c2d46726f6e744d61747465722f6d61737465722e7376673f7374796c653d666c6174)](https://travis-ci.org/Modularr/YAML-FrontMatter)[![Total Downloads](https://camo.githubusercontent.com/698b081a1864d420b274399785035f405c5f0be4cf1368547233151ec440b96e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f64756c6172722f79616d6c2d66726f6e742d6d61747465722e7376673f7374796c653d666c6174)](https://packagist.org/packages/modularr/yaml-front-matter)

An easy to use class for handling YAML frontmatter in PHP.

### What does this class do?

[](#what-does-this-class-do)

This class is a PHP implementation of [Jekyll](https://jekyllrb.com/docs/frontmatter/) **Front Matter**.

> Any file that contains a **YAML front matter block will be processed as a special file**. The front matter must be the first thing in the file and must take the form of **valid YAML set** ***between triple-dashed lines***. Here is a basic example:

```
---
layout: post
title: Blogging Like a Hacker
---
```

Between these triple-dashed lines, you can set variables using YAML. You can access them via the `fetch` function. Conversion to Markdown is optional.

### How to use

[](#how-to-use)

```
$page = new \Modularr\YAMLFrontmatter\FrontMatter('content/example.md');

echo ''.$page->fetch('title').'
'.$page->fetch('content');

foreach($page->fetch('list') as $key => $value) {
    echo ''.$key.' => '.$value.'';
}
$array = $page->fetch('list');
echo $array['foo'];
```

```
---
foo: bar
title: Test
info: you can have as many custom fields as you like
date: 2005-09-16 17:20:42+00:00
layout: post
comments: true
slug: testing
list: { foo: bar, bar: baz }
list2:
- foo
- bar
list3:
    foo: bar
    bar: baz
---
Text Here
content
```

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

[](#installation)

Install in via Composer:

```
composer require modularr/yaml-front-matter

```

If you are using the package in a VanillaJS project make sure you have:

```
require_once 'vendor/autoload.php';
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

2965d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f027c1ea2cde3c848dd3f0966bd5ea2c5331a850518260e878f7448fbb6555a9?d=identicon)[modbot](/maintainers/modbot)

---

Top Contributors

[![spekulatius](https://avatars.githubusercontent.com/u/8433587?v=4)](https://github.com/spekulatius "spekulatius (5 commits)")[![dinglidingli](https://avatars.githubusercontent.com/u/1025132?v=4)](https://github.com/dinglidingli "dinglidingli (3 commits)")[![ISTPdev](https://avatars.githubusercontent.com/u/388467?v=4)](https://github.com/ISTPdev "ISTPdev (3 commits)")[![mre](https://avatars.githubusercontent.com/u/175809?v=4)](https://github.com/mre "mre (2 commits)")[![pbakaus](https://avatars.githubusercontent.com/u/43004?v=4)](https://github.com/pbakaus "pbakaus (2 commits)")

---

Tags

composer-packagephpyaml-frontmatterphpparsermetadataparsingfrontmatter

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k910.8M118](/packages/doctrine-lexer)[simplehtmldom/simplehtmldom

A fast, simple and reliable HTML document parser for PHP.

1921.3M14](/packages/simplehtmldom-simplehtmldom)[parsica-php/parsica

The easiest way to build robust parsers in PHP.

412140.4k4](/packages/parsica-php-parsica)[corveda/php-sandbox

A PHP library that can be used to run PHP code in a sandboxed environment

23483.5k2](/packages/corveda-php-sandbox)[denissimon/formula-parser

Parsing and evaluating mathematical formulas given as strings.

81306.8k3](/packages/denissimon-formula-parser)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)

PHPackages © 2026

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