承接 phptransformers/phptransformer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

phptransformers/phptransformer

最新稳定版本:1.0.0

Composer 安装命令:

composer require phptransformers/phptransformer

包简介

Normalize the API of any PHPTransformer.

关键字:

README 文档

README

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Common interface to manipulate strings/data with any transformer. Great for use in templating libraries, static site generators, web frameworks, and more. Inspired by JSTransformers.

Supported Transformers

To use each of these transformers, you will also need to composer require them in your project.

Install

Via Composer

$ composer require phptransformers/phptransformer

Usage

// With "phptransfomers/twig" package
$transformer = new PhpTransformers\Twig\TwigTransformer();
echo $transformer->render('Hello, {{ name }}!', array(
	'name' => 'World'
));
//=> Hello, World!

API

Before all examples, you will need to load a transformer:

$transformer = new PhpTransformers\Twig\TwigTransformer();
$transformer = new PhpTransformers\Smarty\SmartyTransformer();
// ... same thing for all other Transformers

See each transformers' repository for more details

->render($template, $locals)

Renders the given template string, using the provides locals for options passed in. Returns the result as a string.

$locals = array('name' => 'World');
$output = $transformer->render('Hello, {{ name }}!', $locals);

->renderFile($file, $locals)

Renders the given file, using the provided locals for options passed in. Returns the result as a string.

$locals = array('name' => 'World');
$output = $transformer->renderFile('hello.twig', $locals);

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

统计信息

  • 总下载量: 220
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 3
  • 依赖项目数: 11
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-04-23