定制 allmarkedup/twig-extensions 二次开发

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

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

allmarkedup/twig-extensions

最新稳定版本:v0.2

Composer 安装命令:

composer require allmarkedup/twig-extensions

包简介

A few handy extensions for Twig.

README 文档

README

A few handy extensions for Twig.

Included extensions:

Installation and use

Using composer:

$ composer require allmarkedup/twig-extensions

Then load the required extension(s) into the Twig environment when setting it up as per the instructions in the Twig docs. For example, to use the Markdown extension, you would use something like this:

<?php
use Amu\Twig\TwigMarkdownExtension as MarkdownExtension;
//...
$twig = new Twig_Environment($loader, $options);
$twig->addExtension(new MarkdownExtension());

Included extensions

Markdown Extension

The Markdown extension uses Parsedown under the hood to allow for easy Markdown -> HTML conversion in your templates.

To install:

<?php
$twig->addExtension(new Amu\Twig\TwigMarkdownExtension());

Use it in your templates as a filter:

{{ 'This is a **string**' | markdown }}

Or use it as a tag:

{% markdown %}
_This sentence is emphasised_
> And this is a quote.
{% endmarkdown %}

Running tests

Tests can be run using PHP Unit:

$ vendor/bin/phpunit 

The project also includes a Grunt watch task to run the PHP Unit tests when files are updated which you can use for your convenience.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-10-30