2017 © Pedro Peláez
 

library front-yaml

image

mnapoli/front-yaml

  • Friday, December 1, 2017
  • by mnapoli
  • Repository
  • 5 Watchers
  • 147 Stars
  • 446,202 Installations
  • PHP
  • 25 Dependents
  • 0 Suggesters
  • 15 Forks
  • 5 Open issues
  • 13 Versions
  • 15 % Grown

The README.md

FrontYAML

An implementation of YAML Front matter for PHP. It can parse both YAML and Markdown., (*1)

Total Downloads, (*2)

Installation

Require the project with Composer:, (*3)

composer require mnapoli/front-yaml

Usage

$parser = new Mni\FrontYAML\Parser;

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

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

If you don't want the Markdown to be parsed (maybe because it is not Markdown):, (*4)

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

Example

The following file:, (*5)

---
foo: bar
---
This is **strong**.

Will give:, (*6)

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

var_export($document->getContent());
// "

This is strong, (*7)

"

YAML and Markdown parsers

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

This library uses dependency injection and abstraction to allow you to provide your own YAML or Markdown parser., (*8)

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

FrontYAML uses by default Symfony's YAML parser., (*9)

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

FrontYAML uses by default the League CommonMark parser., (*10)

The Versions

01/12 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

29/10 2017

1.6.0

1.6.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

01/10 2016
15/04 2016
09/03 2015
14/01 2015

1.4.1

1.4.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

14/01 2015

1.4.0

1.4.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

05/01 2015

1.3.0

1.3.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

23/11 2014

1.2.0

1.2.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

01/09 2014

1.1.0

1.1.0.0

  Sources   Download

MIT

The Requires

 

25/01 2014

1.0.2

1.0.2.0

  Sources   Download

MIT

The Requires

 

25/01 2014

1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

 

25/01 2014

1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires