PHP code example of vkbansal / frontmatter
1. Go to this page and download the library: Download vkbansal/frontmatter 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/ */
vkbansal / frontmatter example snippets
KBansal\FrontMatter\Parser;
use VKBansal\FrontMatter\Document;
//Parse a document
$doc = Parser::parse(<<<EOF
---
layout: custom
my_list:
- one
- two
- three
---
Main Title
-----
### Subtitle
Lorem ipsum......
EOF
);
var_dump($doc->getConfig()); // ['layout' => 'custom', 'my_list' => ['one', 'two', 'three']]
var_dump($doc->getContent());
/*
Main Title
-----
### Subtitle
Lorem ipsum.....
*/