https://github.com/xmas7/yaml-front-matter
An easy to use class for handling YAML frontmatter in PHP.
https://github.com/xmas7/yaml-front-matter
front matter yaml
Last synced: about 2 months ago
JSON representation
An easy to use class for handling YAML frontmatter in PHP.
- Host: GitHub
- URL: https://github.com/xmas7/yaml-front-matter
- Owner: xmas7
- License: unlicense
- Created: 2022-09-02T03:37:24.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-09-02T03:37:43.000Z (over 2 years ago)
- Last Synced: 2025-02-01T09:27:42.432Z (4 months ago)
- Topics: front, matter, yaml
- Language: PHP
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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](https://github.com/mojombo/jekyll/wiki/yaml-front-matter) project example. As far as we know the current file format is only compatible with [Statamic](http://statamic.com/ "Statamic is a flexible, flat file CMS").
### 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
---
Text Here
content
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.