定制 davidepastore/slim-markdown-view 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

davidepastore/slim-markdown-view

最新稳定版本:v0.1.1

Composer 安装命令:

composer require davidepastore/slim-markdown-view

包简介

Render PHP view scripts into a PSR-7 Response object.

README 文档

README

Latest version Build Status Coverage Status Quality Score Total Downloads PSR2 Conformance

A renderer for rendering Markdown into a PSR-7 Response object. It works well with Slim Framework 3.

Installation

Install with Composer:

composer require davidepastore/slim-markdown-view

Usage With Slim 3

use \DavidePastore\Slim\Views\MarkdownRenderer;

include "vendor/autoload.php";

$app = new Slim\App();
$container = $app->getContainer();
$container['renderer'] = new MarkdownRenderer("./templates");

$app->get('/hello/', function ($request, $response) {
    return $this->renderer->render($response, "/hello.md");
});

$app->run();

Usage with any PSR-7 Project

//Construct the View
$markdownView = new MarkdownRenderer("./path/to/templates");

//Render a file
$response = $markdownView->render(new Response(), "/path/to/template.md");

Custom Parsedown instance

//Construct the View
$parsedown = Parsedown::instance()->setUrlsLinked(false);
$markdownView = new MarkdownRenderer("./path/to/templates", $parsedown);

//Render a file
$response = $markdownView->render(new Response(), "/path/to/template.md");

Exceptions

\RuntimeException - if template does not exist

Testing

$ phpunit

Contributing

Please see CONTRIBUTING for details.

Credits

统计信息

  • 总下载量: 1.02k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2016-03-05