PHP code example of modularr / yaml-front-matter

1. Go to this page and download the library: Download modularr/yaml-front-matter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

modularr / yaml-front-matter example snippets


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

echo '<h1><a href="'.$page->fetch('uri').'">'.$page->fetch('title').'</a></h1>
'.$page->fetch('content');

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