2017 © Pedro Peláez
 

library yaml-front-matter

A to the point yaml front matter parser

image

spatie/yaml-front-matter

A to the point yaml front matter parser

  • Friday, May 4, 2018
  • by Spatie
  • Repository
  • 5 Watchers
  • 65 Stars
  • 3,720 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 13 Versions
  • 54 % Grown

The README.md

, (*1)

yaml-front-matter

Latest Version on Packagist Software License Build Status Quality Score Total Downloads, (*2)

A to the point front matter parser. Front matter is metadata written in yaml, located at the top of a file wrapped in ---'s., (*3)

---
title: Example
---

Lorem ipsum.
use Spatie\YamlFrontMatter\YamlFrontMatter;

$object = YamlFrontMatter::parse(file_get_contents(__DIR__.'/example.md'));

$object->matter('title'); // => 'Example';
$object->body(); // => 'Lorem ipsum.'

// Or retrieve front matter with a property call...

$object->title; // => 'Example';

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website., (*4)

Support us

, (*5)

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products., (*6)

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall., (*7)

Install

You can install the yaml-front-matter via composer:, (*8)

``` bash $ composer require spatie/yaml-front-matter, (*9)


## Usage Consider the `example.md` file from above. First you'll need to parse the contents: ```php use Spatie\YamlFrontMatter\YamlFrontMatter; $object = YamlFrontMatter::parse(file_get_contents('example.md'));

The parser will return a YamlFrontMatterObject, which can be queried for front matter or it's body., (*10)

$object->matter(); // => ['title' => 'Example']
$object->matter('title'); // => 'Example'
$object->body(); // => 'Lorem ipsum.'
$object->title; // => 'Example'

Protip: The matter function also accepts dot notation for nested fields, e.g. matter('meta.keywords')., (*11)

Changelog

Please see CHANGELOG for more information what has changed recently., (*12)

Testing

bash $ vendor/bin/phpunit, (*13)

Contributing

Please see CONTRIBUTING for details., (*14)

Security

If you've found a bug regarding security please mail security@spatie.be instead of using the issue tracker., (*15)

Postcardware

You're free to use this package, but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using., (*16)

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium., (*17)

We publish all received postcards on our company website., (*18)

Credits

License

The MIT License (MIT). Please see License File for more information., (*19)

The Versions

04/05 2018

dev-master

9999999-dev https://github.com/sebastiandedeyne/yaml-front-matter

A to the point yaml front matter parser

  Sources   Download

MIT

The Requires

 

The Development Requires

yaml spatie jekyll front matter

23/02 2018

2.0.2

2.0.2.0 https://github.com/sebastiandedeyne/yaml-front-matter

A to the point yaml front matter parser

  Sources   Download

MIT

The Requires

 

The Development Requires

yaml spatie jekyll front matter

23/02 2018

dev-allow-matter-without-newline-at-end-of-file

dev-allow-matter-without-newline-at-end-of-file https://github.com/sebastiandedeyne/yaml-front-matter

A to the point yaml front matter parser

  Sources   Download

MIT

The Requires

 

The Development Requires

yaml spatie jekyll front matter

31/01 2018

dev-analysis-8bYbrY

dev-analysis-8bYbrY https://github.com/sebastiandedeyne/yaml-front-matter

A to the point yaml front matter parser

  Sources   Download

MIT

The Requires

 

The Development Requires

yaml spatie jekyll front matter

31/01 2018

dev-fix-regex-for-matter-without-newline-at-the-end-of-file

dev-fix-regex-for-matter-without-newline-at-the-end-of-file https://github.com/sebastiandedeyne/yaml-front-matter

A to the point yaml front matter parser

  Sources   Download

MIT

The Requires

 

The Development Requires

yaml spatie jekyll front matter

31/01 2018

dev-analysis-zdabYJ

dev-analysis-zdabYJ https://github.com/sebastiandedeyne/yaml-front-matter

A to the point yaml front matter parser

  Sources   Download

MIT

The Requires

 

The Development Requires

yaml spatie jekyll front matter

04/09 2017

2.0.1

2.0.1.0 https://github.com/sebastiandedeyne/yaml-front-matter

A to the point yaml front matter parser

  Sources   Download

MIT

The Requires

 

The Development Requires

yaml spatie jekyll front matter

21/08 2017

2.0.0

2.0.0.0 https://github.com/sebastiandedeyne/yaml-front-matter

A to the point yaml front matter parser

  Sources   Download

MIT

The Requires

 

The Development Requires

yaml spatie jekyll front matter

21/08 2017

2.0.0-rc.2

2.0.0.0-RC2 https://github.com/sebastiandedeyne/yaml-front-matter

A to the point yaml front matter parser

  Sources   Download

MIT

The Requires

 

The Development Requires

yaml spatie jekyll front matter

21/08 2017

2.0.0-rc.1

2.0.0.0-RC1 https://github.com/sebastiandedeyne/yaml-front-matter

A to the point yaml front matter parser

  Sources   Download

MIT

The Requires

 

The Development Requires

yaml spatie jekyll front matter

12/07 2017

1.1.0

1.1.0.0 https://github.com/sebastiandedeyne/yaml-front-matter

A to the point yaml front matter parser

  Sources   Download

MIT

The Requires

 

The Development Requires

yaml spatie jekyll front matter

27/01 2016

1.0.1

1.0.1.0 https://github.com/sebastiandedeyne/yaml-front-matter

A to the point yaml front matter parser

  Sources   Download

MIT

The Requires

 

The Development Requires

yaml spatie jekyll front matter

14/01 2016

1.0.0

1.0.0.0 https://github.com/sebastiandedeyne/yaml-front-matter

A to the point yaml front matter parser

  Sources   Download

MIT

The Requires

 

The Development Requires

yaml spatie jekyll front matter