All Projects → spatie → yaml-front-matter

spatie / yaml-front-matter

Licence: MIT License
A to the point yaml front matter parser

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to yaml-front-matter

tr4n5l4te
Use Google Translate without an API key.
Stars: ✭ 32 (-84%)
Mutual labels:  yaml
vscode-fortran-support
Fortran language support for Visual Studio Code
Stars: ✭ 49 (-75.5%)
Mutual labels:  formatting
pyaml env
Parse YAML configuration with environment variables in Python
Stars: ✭ 36 (-82%)
Mutual labels:  yaml
odin
Data-structure definition/validation/traversal, mapping and serialisation toolkit for Python
Stars: ✭ 24 (-88%)
Mutual labels:  yaml
yaask
Make your yaml configurable with interactive configurations!
Stars: ✭ 15 (-92.5%)
Mutual labels:  yaml
dby
Simple Yaml DB
Stars: ✭ 47 (-76.5%)
Mutual labels:  yaml
coAST
Universal and language-independent abstract syntax tree
Stars: ✭ 30 (-85%)
Mutual labels:  yaml
yamlful
YAML-based HTTP client code generation
Stars: ✭ 77 (-61.5%)
Mutual labels:  yaml
Config
PHP library for simple configuration management
Stars: ✭ 39 (-80.5%)
Mutual labels:  yaml
Obsidian-Markdown-Parser
This repository will give you tools to parse and fetch useful informations of your notes in your Obsidian vault.
Stars: ✭ 32 (-84%)
Mutual labels:  yaml
CHRTextFieldFormatter
Provides UITextField formatting masks. Such as phone number and credit card number formatters.
Stars: ✭ 52 (-74%)
Mutual labels:  formatting
goodconf
Transparently load variables from environment or JSON/YAML file.
Stars: ✭ 80 (-60%)
Mutual labels:  yaml
gsheet to arb
Import translations (ARB/Dart) from Google Sheets
Stars: ✭ 21 (-89.5%)
Mutual labels:  yaml
php-helpers
A Collection of useful php helper functions.
Stars: ✭ 26 (-87%)
Mutual labels:  yaml
python-yamlordereddictloader
(DEPRECATED) YAML loader and dumper for PyYAML allowing to keep keys order.
Stars: ✭ 25 (-87.5%)
Mutual labels:  yaml
pystest
WEB UI自动化测试框架,selenium结合python,测试人员不需要会代码,只需要写配置即可实现,并且方便懂代码的测试人员扩展
Stars: ✭ 24 (-88%)
Mutual labels:  yaml
address-formatter
Universal international address formatter in Javascript
Stars: ✭ 65 (-67.5%)
Mutual labels:  formatting
counsel-jq
Traverse complex JSON and YAML structures with live feedback
Stars: ✭ 99 (-50.5%)
Mutual labels:  yaml
openapiclientgen
Generate C# and TypeScript client codes from Open API / Swagger definitions
Stars: ✭ 31 (-84.5%)
Mutual labels:  yaml
crystalizer
(De)serialize any Crystal object - out of the box. Supports JSON, YAML and Byte format.
Stars: ✭ 32 (-84%)
Mutual labels:  yaml

yaml-front-matter

Latest Version on Packagist Software License Build Status Quality Score Total Downloads

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

---
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.

Support us

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.

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.

Install

You can install the yaml-front-matter via composer:

$ composer require spatie/yaml-front-matter

Usage

Consider the example.md file from above. First you'll need to parse the contents:

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.

$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').

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

Security

If you've found a bug regarding security please mail [email protected] instead of using the issue tracker.

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.

Our address is: Spatie, Kruikstraat 22, 2018 Antwerp, Belgium.

We publish all received postcards on our company website.

Credits

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].