Skip to content

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

License

Notifications You must be signed in to change notification settings

mre/YAML-FrontMatter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YAML Front Matter

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

What does this class do?

YAML Front Matter is a technique used to keep metadata about the file seperated from the actual content inside the file, while still only having 1 file. This simple PHP class allows you to read such files, and return each of the metadata or content independantly.

What files are compatible with this class?

This class is currently a stict format. The current format is following the original Jekyll project example. As far as we know the current file format is only compatible with Statamic.

The format:

The current strict format is as follows:

---
foo: bar
title: Test
expl: Make sure there is only 1 space between each of the variables
info: you can have as many custom fields as you like
---
<h1>Text Here</h1>
<p>content</p>

There is no conversion from Markdown so you will have to implement your own, or if you want you can simply use HTML and even PHP directly.

How to use this class?

example/example.php is an example file that shows you how to use this class.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%