定制 srcoder/template-bridge 二次开发

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

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

srcoder/template-bridge

Composer 安装命令:

composer require srcoder/template-bridge

包简介

Template bridge between your legacy and other template engines

README 文档

README

Template bridge between your legacy php code and newer template engines.

Dependencies

Requires minimum of PHP 7.0. Also uses srcoder/normalize-strings for string manipulation.

Engines

  • Plain
  • Twig
  • Compatible

Basic usage

Use the manager to define your templates.

use \Srcoder\TemplateBridge\Manager;
use \Srcoder\TemplateBridge\Engine\Twig;
use \Srcoder\TemplateBridge\Engine\Plain;

// Initialize template bridge
$templateBridge = new Manager;
// or static
$templateBridge = Manager::instance();

// Add a engine
$templateBridge->add(
        'twig',         // Name
        new Twig(),     // Template engine
        300             // Prio, higher is more important
);

$templateBridge->add(
        'plain',        // Name
        new Plain(),    // Template engine
        600             // Prio, higher is more important
);


// Adding a file
$templateManager->addFile('file');
// Will search for file.twig and file

// Render template
echo $templateBridge->render();

Data

When rendering something you can add data to it.

use \Srcoder\TemplateBridge\Data;

echo $templateBridge->render(new Data(['key' => 'value']))

Fun part

Twig engine

When a Twig file is found it will work exactly as you expect.

Plain engine

Plain files will replace {{$variable}} from the Data object Plain engine can also be used for javascript and html

Compatible engine

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固