appneta/traceview-twig
最新稳定版本:v0.1.0
Composer 安装命令:
composer require appneta/traceview-twig
包简介
Additional Twig integration for AppNeta TraceView.
README 文档
README
The AppNeta\TraceViewTwig package provides integration points between Twig and
AppNeta TraceView. It currently supports:
- Tracking Twig template rendering as profiles
- Injecting real user monitoring JavaScript (via Twig extension)
Template Tracking
Twig template tracking is provided by replacing the Twig base template class with
a TraceView-augmented one. The easiest way to load the relevant base template
class is to add this package as a require in your composer.json:
"require": {
"php": ">=5.3.3",
[...]
"appneta/traceview-twig": "master@dev"
},
If you're using Twig with Symfony2, you can add this line to the twig section
of your config.yml:
twig:
base_template_class: AppNeta\TraceViewTwig\Template\TraceViewTwigTemplate
If you're manually constructing a Twig environment, you should instead use the
base_template_class option:
$options = array(
'cache' => ...,
'base_template_class' => AppNeta\TraceViewTwig\Template\TraceViewTwigTemplate
);
$twigEnv = new Twig_Environment($loader, $options);
Real User Monitoring
TraceView real user monitoring JavaScript is usually added by calling the
oboe_get_rum_header and oboe_get_rum_footer functions. Because Twig templates
do not allow arbitrary PHP execution, this package provides a Twig extension that
exposes them as Twig functions.
If you're using Twig with Symfony2, you can load the extension from your config.yml:
appneta.twig.traceview_twig_rum_extension:
class: AppNeta\TraceViewTwig\Extension\TraceViewRUMExtension
tags:
- { name: twig.extension }
If you're manually constructing a Twig environment, you should instead call the
addExtension method directly:
$twigEnv = new Twig_Environment($loader, $options);
$twigEnv->addExtension(new AppNeta\TraceViewTwig\Extension\TraceViewRUMExtension);
For full details on placing these snippets, please see this knowledge base article. Here is a basic example:
<html>
<head>
<meta ... >
{{ oboe_get_rum_header() }}
</head>
<body>
...
{{ oboe_get_rum_footer() }}
</body>
</html>
Note: these functions only accept one argument: whether to output <script>
tags around the snippet (defaults to true).
The best place to put these functions is in your root Twig layout template (such
as TwigBundle::layout.html.twig). It is possible to use these Twig functions
in a block, like javascript or body, but there are two downsides: you may
inadvertantly output the script tags more than once per HTML document, and the
timing information will be less accurate if the JavaScript gets loaded after other JavaScript or CSS stylesheets.
Contributors
Thanks to Willem van der Jagt of Cakemail for writing the initial integration between TraceView RUM and Twig!
Contributing
The best way to improve this package is to work with the people using it! We actively encourage patches, pull requests, feature requests, and bug reports.
appneta/traceview-twig 适用场景与选型建议
appneta/traceview-twig 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.8k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 10 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「performance」 「twig」 「monitoring」 「traceview」 「appneta」 「apm」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 appneta/traceview-twig 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 appneta/traceview-twig 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 appneta/traceview-twig 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
g4 application profiler package
CSS/Javascript Minificator, Compressor and Concatenator for TYPO3 - highly configurable frontend asset optimization for CSS/JS merging, minification and compression with optional body parsing, async/defer loading, inline output, data-ignore exclusions, SRI integrity validation/calculation, external
This Symfony bundle integrates PhpSpreadsheet into Symfony using Twig.
A Twig extension to insert css as inline styles with a tag
A Symfony bundle for chameleon-system/sanitycheck
统计信息
- 总下载量: 5.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2014-10-23