davro/fabrication
Composer 安装命令:
composer require davro/fabrication
包简介
DOM based Template Engine no placeholders!
README 文档
README
Introduction
PHP Template Engine based on the Document Object Model.
The FabricationEngine engine is not like most of the other templating engine's on the market, mainly because the engine has no concept of place holders, it is only concerned with elements and attributes, structures, expressions and instructions for content that requires processing.
Structures are the templates and expressions are paths to the elements contained within the Document Object Model. The FabricationEngine extends the PHP builtin DOMDocument in many ways and enables the native usage of the XPath object. This allows for an insanely flexible and extensible templating engine.
You can create a DOM structure by loading a html, xhtml, xml string or simply by loading a file, or you can build your own document structure by using the native DOMDoument API. Also there is a specifcation method with the ability to recursivly create structures. There are also some advanced dateset templating features.
Features
Templating without place holders. Dataset Templating.
Documentation
Example: Assign key, value pair and output.
Simple example of Input/Output.
Documentation example, Assign.
<?php $engine = new Fabrication\FabricationEngine(); $engine->input('hello', 'world'); echo $engine->output('hello'); # # world # ?>
Example: Assign ID #key, value pair.
ID keys are automatically mapped to DOM elements with matching identifiers.
Documentation example, Assign by ID.
<?php $template = '<html><head></head><body><div id="hello"></div></body></html>'; $engine = new Fabrication\FabricationEngine(); $engine->input('#hello', 'world'); $engine->run($template); echo $engine->output('#hello'); # # world # echo $engine->saveHTML(); # # <html><head></head><body><div id="hello">world</div></body></html> # echo $engine->saveFabric(); # # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" # "http://www.w3.org/TR/html4/loose.dtd">'. # <html><head></head><body><div id="hello">world</div></body></html> # ?>
Example: Input class .key, value pair.
Class keys are automatically mapped to elements with matching class identifiers.
<?php $template = '<html><head></head><body><div class="hello"></div></body></html>'; $engine = new Fabrication\FabricationEngine(); $engine->input('.hello', 'world'); $engine->run($template); echo $engine->output('.hello'); # # world # echo $engine->saveHTML(); # # <html><head></head><body><div class="hello">world</div></body></html> # echo $engine->saveFabric(); # # <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" # "http://www.w3.org/TR/html4/loose.dtd">'. # <html><head></head><body><div class="hello">world</div></body></html> # ?>
Documentation examples.
Composer and Tagging notes.
https://packagist.org/packages/davro/fabrication
$ git tag 1.0.5 $ git tag 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5
$ git push --tags Total 0 (delta 0), reused 0 (delta 0) To https://github.com/davro/fabrication.git
- [new tag] 1.0.5 -> 1.0.5
Tagging a branch on github will also notify packagist.org to update to the new tag.
Contributors
- David Stevens (davro) (https://www.davro.net)
License
Fabrication Engine is released under the LGPL license.
davro/fabrication 适用场景与选型建议
davro/fabrication 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 105 次下载、GitHub Stars 达 7, 最近一次更新时间为 2015 年 02 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「template」 「dom」 「engine」 「domdocument」 「fabric」 「fabrication」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 davro/fabrication 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 davro/fabrication 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 davro/fabrication 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A library that provides basic utilities for creating HTML documents.
A bridge between SimpleXML and the DOM extension, plus a bunch of convenience methods
BigPipe: Pipelining web pages for high performance built in PHP.
A SilverStripe module to optimise the Meta, crawling, indexing, and sharing of your website content (forked from Cyber-Duck/Silverstripe-SEO)
Load DOM document safety
A Processor for Markup written in PHP. Allows extraction of Markup into a data structure, orchestrated nested manipulation of said structure, and output as (optimized) Markup.
统计信息
- 总下载量: 105
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 8
- 点击次数: 14
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2015-02-08