PHP code example of mnapoli / front-yaml

1. Go to this page and download the library: Download mnapoli/front-yaml 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/ */

    

mnapoli / front-yaml example snippets


$parser = new Mni\FrontYAML\Parser;

$document = $parser->parse($str);

$yaml = $document->getYAML();
$html = $document->getContent();

$document = $parser->parse($str, false);

var_export($document->getYAML());
// array("foo" => "bar")

var_export($document->getContent());
// "<p>This is <strong>strong</strong></p>"

$parser = new Mni\FrontYAML\Parser($yamlParser, $markdownParser);

interface YAMLParser
{
    public function parse($yaml);
}

interface MarkdownParser
{
    public function parse($markdown);
}