fuel/parser
Composer 安装命令:
composer require fuel/parser
包简介
FuelPHP 1.x Parser Package
README 文档
README
Installing
Simply add parser to your config.php always_loaded.packages config option.
Included Parsers
- Markdown - A PHP version of Markdown by Michel Fortin.
Usage
// old usage still valid, will load app/views/example.php View::forge('example'); // load a Mustache template, will load and parse app/views/example.mustache View::forge('example.mustache'); // load a Twig template, will load and parse app/views/example.twig View::forge('example.twig'); // load a Hybrid Haml / Twig template, ATTENTION: this one actually loads app/views/example.twig and {% haml %} code at the top of the view View::forge('example.mthaml'); // load a Jade template, will load and parse app/views/example.jade View::forge('example.jade'); // load a Plates template, will load and parse app/views/example.plates View::forge('example.plates'); // load a Haml template, will load and parse app/views/example.haml View::forge('example.haml'); // load a Smarty template, will load and parse app/views/example.smarty View::forge('example.smarty'); // load a Lex template, will load and parse app/views/example.lex View::forge('example.lex'); // load a Dwoo template, ATTENTION: this one actually loads app/views/example.tpl View::forge('example.dwoo'); // load a Handlebars template, will load and parse app/views/example.handlebars View::forge('example.handlebars'); // load a Plates template, ATTENTION: this one actually loads app/views/example.tpl View::forge('example.plates');
Installing parsers
To be able to use one of the supported parsers, you need to install them via composer.
Simply add the libraries to your project's composer.json then run php composer.phar install:
{
"require": {
"dwoo/dwoo" : "*",
"mustache/mustache" : "*",
"smarty/smarty" : "*",
"twig/twig" : "2.*",
"mthaml/mthaml": "*",
"pyrocms/lex": "*",
"league/plates" : "3.*",
"zordius/lightncandy" : "dev-master"
}
}
Note that the Markdown parser is installed by default, as it is also used by the FuelPHP core class Markdown.
Libraries that can not be installed through composer are expected to be installed in in APPPATH/vendor/lib_name (capitalize lib_name),
and you'll have to download them yourself. Don't change the casing or anything, keep it as much original as possible within the vendor/lib_name
dir to keep updating easy (also because some come with their own autoloader).
You can configure them to be loaded from other locations by copying the parser.php config file to your app and editing it.
Config and runtime config
Currently the drivers still lack a lot of config options they should probably accept. They are currently all configured to work with one instance of their parser library, which is available to config:
// Clear the cache for a specific Smarty template $view = View::forge('example.smarty'); $view->parser()->clearCache('example.smarty'); // Example static usage View_Smarty::parser()->clearCache('example.smarty');
fuel/parser 适用场景与选型建议
fuel/parser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.23M 次下载、GitHub Stars 达 60, 最近一次更新时间为 2016 年 04 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 fuel/parser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 fuel/parser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.23M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 60
- 点击次数: 27
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-12