定制 laemmi/simple-template-engine 二次开发

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

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

laemmi/simple-template-engine

Composer 安装命令:

composer require laemmi/simple-template-engine

包简介

This is very simple template engine to parse templates

README 文档

README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

Simple template engine

This is very simple template engine to parse templates.

Requirements

php 7.2

Installation

via composer

composer require laemmi/simple-template-engine

or use repository

git clone https://github.com/Laemmi/simple-template-engine.git

Usage

In this package you have to compiler. Once for replacing variable and one for if statements. For the variable compiler you can use modifiers. In default you can use all php functions like strtoupper etc.

Use with factory

$template = TemplateFactory::factory('My name is {if $name}{#name|strtoupper#}{/if} and i am {#age#} years old.');
$template->name = 'Michael';
$template->age  = 99;
$template();

// My name is MICHAEL and i am 99 years old.

Use with callback modifier

$callback = new ModifierCallback('custom', function($value) {
    return sprintf('Sir %s', $value);
});

$compiler = new CompileVariable();
$compiler->addModifier($callback);

$template = new Template('My name is {#name|custom#}');
$template->addPlugin($compiler);
$template->name = 'Michael';
$template();

// My name is Sir Michael

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固