PHPackages                             devster/frontmatter - 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. devster/frontmatter

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

devster/frontmatter
===================

A php `frontmatter` parser

8200[2 issues](https://github.com/devster/frontmatter/issues)PHP

Since Mar 15Pushed 11y ago3 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Frontmatter parser
==================

[](#frontmatter-parser)

[![Latest Version](https://camo.githubusercontent.com/e5acb005d07cc6e29b5742df5e0b56eb83811aaed2df3976469b5fb36ed3486e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f646576737465722f66726f6e746d61747465722e7376673f7374796c653d666c61742d737175617265)](https://github.com/devster/frontmatter/releases)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/1075cceafdf8b8b1a76a1a6e653a0d072d6d76269886c481e3c8887a990294e4/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f646576737465722f66726f6e746d61747465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/devster/frontmatter)[![Coverage Status](https://camo.githubusercontent.com/19e6dedd980a4a06a5d9ce1f1ed8e594a6aeffcf9ba9e47707f7f7f28e0bc1b4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f646576737465722f66726f6e746d61747465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/devster/frontmatter/code-structure)[![Quality Score](https://camo.githubusercontent.com/0706dd2c008dbac6178f4c451e8f93d793eb6864ae4bb878b0556d972e8e0fe6/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f646576737465722f66726f6e746d61747465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/devster/frontmatter)[![Total Downloads](https://camo.githubusercontent.com/f37339e16d6684f94f4dbd085cffd7186884e3448b80b1b0538d44891a8946bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646576737465722f66726f6e746d61747465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/devster/frontmatter)

\[WIP\] Frontmatter Jekyll style parser

Available parsers:

- yaml (use [symfony/yaml](https://github.com/symfony/Yaml))
- Markdown (use [erusev/parsedown-extra](https://github.com/erusev/parsedown-extra))
- Json (use [seld/jsonlint](https://github.com/seld/jsonlint))

Install
-------

[](#install)

Via Composer

```
$ composer require devster/frontmatter
```

And add extra packages that built-in parsers use:

```
# YAML
$ composer require symfony/yaml

# Markdown
$ composer require erusev/parsedown-extra

# Json
$ composer require seld/jsonlint
```

*These packages are not required by default to minimize the footprint and speed up your install if you only need few of them*

Usage
-----

[](#usage)

### Basic usage

[](#basic-usage)

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

$parser = new Devster\Frontmatter\Parser('yaml', 'markdown');
$content = getBody(); // This is Markdown content
```

And because the frontmatter format is not only used by developers, this parser is quite permissive

All content examples above are parsed like normal frontmatter content:

```
$content =
