{"repo":"webuni/front-matter","free":true,"listed":false,"github":"https://github.com/webuni/front-matter","clone":"git clone https://github.com/webuni/front-matter.git","description":"The most featured front matter (yaml, json, neon, toml) parser and dumper for PHP.","language":"PHP","stars":39,"topics":["yaml","neon","toml","front-matter","json","php","twig","markdown","commonmark"],"license":"MIT","category":"productivity","readme_excerpt":"Front Matter ============ The most universal Front matter (yaml, json, neon, toml) parser and dumper for PHP. Front matter allows page-specific variables to be included at the top of a page. Features -------- This library can parse all form of front matter: YAML (Neon) TOML Json Twig Pug Installation ------------ This library can be installed via Composer: composer require webuni/front-matter Usage ----- Automatic front matter detection and parsing The following code will automatically detect the above front matter types: Parse an arbitrary string Check if a string has front matter Twig loader If you want to store metadata about twig template, e.g.: you can use FrontMatterLoader , that decorates another Twig loader: It is possible to inject front matter to Twig template as variables: Loaded Twig template has this code: Available converters: Converter Twig ----------------------------------------- ------------------------------------------------------------ DataToTwigConvertor::nothing() DataToTwigConvertor::vars() {% set key1 = value1 %} DataToTwigConvertor::vars(false) {% set key1 = key1 is defined ? key1 : value1 %} DataToTwigConvertor::var('name') {% set name = {key1: value1, key2: value2} %} DataToTwigConvertor::var('name', false) {% set name = name is defined ? name : {key1: value1} %} Markdown The most commonly used front matter is for markdown files: This library can be used with league/commonmark: Alternatives ------------ - https://github.com/spatie/yaml-front-matter","default_branch":null,"files":null,"tree":[],"storefront":"/r/webuni","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/webuni/front-matter/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}