定制 phptransformers/phptransformer 二次开发

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

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

phptransformers/phptransformer

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.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固