承接 futape/simple-template 相关项目开发

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

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

futape/simple-template

Composer 安装命令:

composer require futape/simple-template

包简介

A damn simple template engine

README 文档

README

This library offers a very simple template engine.

The engine's only function is to resolve placeholders in the template to defined variable values or PHP constants.

Install

composer require futape/simple-template

Usage

use Futape\SimpleTemplate\Template;

$template = (new Template(
    "Hello {{\$name}},\n\nthis is an usage example of futape/simple-template.\nYour installed PHP version is " .
        "{{PHP_VERSION}}."
))
    ->addVariable('name', 'Stranger');

echo $template->render();
/* Hello Stranger,

this is an usage example of futape/simple-template.
Your installed PHP version is 7.2.0. */

Placeholders may be escaped using a \ in front of the second {.
{\{$foo}} would result in {{$foo}} (or {\{$foo}} if the unescapePlaceholders config is disabled).

The engine can be configured, either via a constructor's second argument or by calling setConfig().
The following configuration options exist:

Name Type Default Description
unescapePlaceholders bool true If \ characters used to escape placeholders should be removed from the rendered template
resolveConstants bool true If resolving placeholders to constants is enabled
discardUndefinedVariables bool true If unresolvable placeholders should be removed from the rendered template

Testing

The library is tested by unit tests using PHP Unit.

To execute the tests, install the composer dependencies (including the dev-dependencies), switch into the tests directory and run the following command:

../vendor/bin/phpunit

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-11-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固