slepic/templated-tracy-bar-panel
Composer 安装命令:
composer require slepic/templated-tracy-bar-panel
包简介
Generic implementaton of Tracy\IBarPanel which allows you to implement IBarPanel factory classes instead of implementing IBarPanel directly.
README 文档
README
templated-tracy-bar-panel
A simple implementation of Tracy\IBarPanel that allows you to create custom panels by composition of two templates (for tab and panel respectively) and a data provider which feeds the templates with specific data.
The advantage of using TemplatedBarPanel instead of implementing the IBarPanel interface directly are:
- Implement just the
TemplateDataProviderInterfaceand use your favourite templating engine for tab and panel templates. - You abstract your implementation from a specific templating engine. Once you find a better/faster templating engine you can switch to it by just reimplementing the templates and not the way the data for them are gathered.
- You allow your panels to change their look without having to modify them. You just pass different templates to them.
Requirements
- PHP 5.6 or PHP 7.0
- slepic/php-template (packagist)
Installation
Install with composer
composer require slepic/templated-tracy-bar-panel
Usage
When implementing a IBarPanel for Tracy, instead of implementing the interface directly, create just a factory class, which will instantiate the TemplatedBarPanel like this:
class Factory
{
/**
* @param ...$dependencies Dependencies specific to your panel.
* @return IBarPanel
*/
public function create(...$dependencies)
{
return new TemplatedBarPanel(
new MyTemplateDataProvider(...$dependencies),
new OutputBufferTemplate(__DIR__ . '/tab.phtml'),
new OutputBufferTemplate(__DIR__ . '/panel.phtml')
);
}
}
You need to implement the TemplateDataProviderInterface to provide specific data for your templates.
The two templates can be the OutputBufferTemplate provided by the slepic/php-template package.
But if you prefer a higher level template engine, see slepic/php-template-implementation to see if there is an existing binding for your favourite templating engine.
Changelog
0.2.0
- Update dependency slepic/php-template to v0.2.
- Changed return type of
TemplateDataProviderInterface::getTabData()andTemplateDataProviderInterface::getPanelData()to array. - Changed travis setup to only run tests in oldest and newest php versions supported by this package (that is 5.6 and 7.3).
slepic/templated-tracy-bar-panel 适用场景与选型建议
slepic/templated-tracy-bar-panel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 20.13k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2019 年 04 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 slepic/templated-tracy-bar-panel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 slepic/templated-tracy-bar-panel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 20.13k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 10
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-04-28