r3c/deval
Composer 安装命令:
composer require r3c/deval
包简介
Template engine with support for partial evaluation at compilation
README 文档
README
Overview
Deval is a PHP template engine with support for partial evaluation at compilation to enable early error detection, optimize generated code and improve execution performance.
While most PHP template engines follow a “load variables and render” workflow Deval introduces an intermediate pre-compilation injection step to specify variables that you know won’t change on every rendering. By doing so, Deval will pre-evaluate your template and generate specialized code where all these invariants have been evaluated.
This sample template:
{{ $ locale(language, "users.list") }}
{{ for user in users }}
- {{ $ user.login }}
{{ empty }}
{{ $ locale(language, "no.users") }}
{{ end }}
Will compile a PHP snippet similar to this one after injecting a locale
function and a language variable:
Registered user:
<?php $_counter = 0; foreach ($users as $user) { ?>
- <?php echo $user->login; ?>
<?php ++$_counter; } if ($_counter === 0) { ?>
No users registered.
<?php } ?>
As you can see all statements depending on variables locale and language have been evaluated in generated code, as their value was known at compile time. Other variables have been left untouched and Deval expects you to specify their value when rendering the template (and will raise an error if you don’t).
Instructions
Either install Deval with Composer and autoload it:
composer require r3c/deval
Or download latest release from GitHub then unpack & require manually:
require 'path/to/deval/deval.php';
Full documentation is available on Read the Docs.
Resource
- Contact: v.github.com+deval [at] mirari [dot] fr
- License: license.md
r3c/deval 适用场景与选型建议
r3c/deval 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 08 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 r3c/deval 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 r3c/deval 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 14
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-14