vkbansal/frontmatter

此包已被弃用且不再维护。作者建议使用 webuni/front-matter 包。

Frontmatter 允许使用 YAML、JSON 或 INI 格式在模板顶部包含页面特定的变量。

v1.3.2 2015-07-12 15:33 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:39:40 UTC


README

使用 https://github.com/webuni/front-matter 代替

Latest Stable Version Build Status Scrutinizer Code Quality Code Coverage Code Climate License Dependency Status

SensioLabsInsight #FrontMatter Frontmatter 允许使用 YAML 或 JSON 格式在模板顶部包含页面特定的变量。

##需求

  • PHP >= 5.4

##安装 创建或更新您的 composer.json 文件,并运行 composer update

$ composer require vkbansal/frontmatter

##支持的格式

  • YAML
  • JSON
  • INI

快速使用

<?php

require '../vendor/autoload.php';

use VKBansal\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.....
*/

更多详细的使用方法请参阅 网站

##许可证 MIT

##变更日志 Changelog